|
@@ -1326,12 +1326,26 @@ public class DateUtils extends PropertyEditorSupport {
|
|
c.setTime(Objects.requireNonNull(parseDate(endDate, SystemDateConstant.yyyy_MM_dd)));
|
|
c.setTime(Objects.requireNonNull(parseDate(endDate, SystemDateConstant.yyyy_MM_dd)));
|
|
long time2 = c.getTimeInMillis();
|
|
long time2 = c.getTimeInMillis();
|
|
long between_days = (time2 - time1) / (1000 * 3600 * 24);
|
|
long between_days = (time2 - time1) / (1000 * 3600 * 24);
|
|
- int day=Integer.parseInt(String.valueOf(between_days));
|
|
|
|
- return day>180;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public static void main(String[] args) throws ParseException {
|
|
|
|
- System.out.println(calDiffMonth(DateUtils.parseDate("2019-04-01", "yyyy-MM-dd"), new Date()));
|
|
|
|
|
|
+ int day = Integer.parseInt(String.valueOf(between_days));
|
|
|
|
+ return day > 180;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static List<Date> findDates(Date dBegin, Date dEnd) {
|
|
|
|
+ List<Date> lDate = new ArrayList<Date>();
|
|
|
|
+ lDate.add(dBegin);
|
|
|
|
+ Calendar calBegin = Calendar.getInstance();
|
|
|
|
+ // 使用给定的 Date 设置此 Calendar 的时间
|
|
|
|
+ calBegin.setTime(dBegin);
|
|
|
|
+ Calendar calEnd = Calendar.getInstance();
|
|
|
|
+ // 使用给定的 Date 设置此 Calendar 的时间
|
|
|
|
+ calEnd.setTime(dEnd);
|
|
|
|
+ // 测试此日期是否在指定日期之后
|
|
|
|
+ while (dEnd.after(calBegin.getTime())) {
|
|
|
|
+ // 根据日历的规则,为给定的日历字段添加或减去指定的时间量
|
|
|
|
+ calBegin.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
+ lDate.add(calBegin.getTime());
|
|
|
|
+ }
|
|
|
|
+ return lDate;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|