赞
踩
java判断当前日期是否在某个日期之前:
- /**
- * 判断当前时间是否在某个时间之前
- * @param tagDateTime 判断的标准
- * @return true是,false不是
- */
- public static boolean belongCalendarBefore(String tagDateTime) {
- try {
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
- Calendar contCalendar = Calendar.getInstance();
- Calendar tagCalendar = (Calendar) contCalendar.clone();
- tagCalendar.setTime(dateFormat.parse(tagDateTime));
-
- return contCalendar.before(tagCalendar);
- } catch (ParseException e) {
- e.printStackTrace();
- }
- return false;
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。