当前位置:   article > 正文

判断当前日期是否在某个日期之前_java 判断日期在当月15日之前

java 判断日期在当月15日之前

java判断当前日期是否在某个日期之前:

  1. /**
  2. * 判断当前时间是否在某个时间之前
  3. * @param tagDateTime 判断的标准
  4. * @return true是,false不是
  5. */
  6. public static boolean belongCalendarBefore(String tagDateTime) {
  7. try {
  8. DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  9. Calendar contCalendar = Calendar.getInstance();
  10. Calendar tagCalendar = (Calendar) contCalendar.clone();
  11. tagCalendar.setTime(dateFormat.parse(tagDateTime));
  12. return contCalendar.before(tagCalendar);
  13. } catch (ParseException e) {
  14. e.printStackTrace();
  15. }
  16. return false;
  17. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/260515
推荐阅读
相关标签
  

闽ICP备14008679号