mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
后管sim卡页面添加字段
This commit is contained in:
@@ -196,6 +196,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date());
|
||||
System.out.println(dateToStr);
|
||||
|
||||
String poorDays = getPoorDays(addDay(new Date(), -7), new Date());
|
||||
System.out.println(poorDays);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,10 +210,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算相差天数
|
||||
* 计算相差天数(不会显示负值)
|
||||
*/
|
||||
public static int differentDaysByMillisecond(Date date1, Date date2) {
|
||||
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
|
||||
public static int differentDaysByMillisecond(Date beginDate, Date endDate) {
|
||||
return Math.abs((int) ((endDate.getTime() - beginDate.getTime()) / (1000 * 3600 * 24)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算相差天数 (会显示负值)
|
||||
* @param endDate
|
||||
* @param nowDate
|
||||
* @return
|
||||
*/
|
||||
public static String getPoorDays(Date endDate, Date nowDate) {
|
||||
long nd = 1000 * 24 * 60 * 60;
|
||||
long diff = endDate.getTime() - nowDate.getTime();
|
||||
long day = diff / nd;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (day != 0) {
|
||||
sb.append(day);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user