|
@@ -88,12 +88,14 @@ public class DateUtil {
|
|
|
return enddate + " 23:59:59.999";
|
|
|
}
|
|
|
|
|
|
- public static Date getDatetimeAfterCentury(Date date) {
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(date);
|
|
|
- calendar.set(2000, Calendar.DECEMBER, 31, calendar.get(Calendar.HOUR_OF_DAY),
|
|
|
- calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND));
|
|
|
- return calendar.getTime();
|
|
|
+ public static int daysBetween(Date begntime,Date endtime) {
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(begntime);
|
|
|
+ long time1 = cal.getTimeInMillis();
|
|
|
+ cal.setTime(endtime);
|
|
|
+ long time2 = cal.getTimeInMillis();
|
|
|
+ long between_days = (time2 - time1) / (1000 * 3600 * 24);
|
|
|
+ return Integer.parseInt(String.valueOf(between_days));
|
|
|
}
|
|
|
|
|
|
public static Integer calculateAge(Date birthDate) {
|
|
@@ -134,11 +136,6 @@ public class DateUtil {
|
|
|
return time.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
|
|
|
}
|
|
|
|
|
|
- public static String plusSeconds(int seconds) {
|
|
|
- LocalDateTime time = LocalDateTime.now().plusSeconds(seconds);
|
|
|
- return time.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param nowTime 当前时间
|
|
|
* @param startTime 开始时间
|