posts - 33,  comments - 17,  trackbacks - 0
 public static boolean checkDate(String str) {
  boolean bolRet = true;
  if (StringUtils.isNotEmpty(str)) {
   try {
    SimpleDateFormat formatDate = new SimpleDateFormat("yyyy/MM/dd");
    //    将某个日期以固定格式转化成字符串
   //    String str = sdf.format(formatDate );
    formatDate.setLenient(false);
    Calendar calendar = Calendar.getInstance();
    java.util.Date date = formatDate.parse(str);
    calendar.setTime(date);
    int nowYear = calendar.get(Calendar.YEAR);
    bolRet = (nowYear >= 2000) && (nowYear <= 9999)
      && formatDate.format(date).equals(str);
   } catch (Exception ex) {
    bolRet = false;
    System.out.println(ex);
   }
  }
  return bolRet;
 }
posted on 2008-05-23 15:53 scea2009 阅读(163) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

<2008年5月>
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

常用链接

留言簿(1)

随笔分类

随笔档案

PL/SQL存储过程与函数

搜索

  •  

最新评论

阅读排行榜

评论排行榜