|
@@ -1,6 +1,8 @@
|
|
|
package org.jeecg.modules.adweb.common.util;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.ZoneId;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -91,4 +93,17 @@ public class DateUtil {
|
|
|
c.add(Calendar.DAY_OF_MONTH, num);
|
|
|
return c.getTime();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算两个Date的日期差
|
|
|
+ *
|
|
|
+ * @param start
|
|
|
+ * @param end
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static long diffDays(Date start, Date end) {
|
|
|
+ return ChronoUnit.DAYS.between(
|
|
|
+ LocalDate.ofInstant(start.toInstant(), DEFAULT_ZONE_ID),
|
|
|
+ LocalDate.ofInstant(end.toInstant(), DEFAULT_ZONE_ID));
|
|
|
+ }
|
|
|
}
|