后管sim卡页面添加字段

This commit is contained in:
Lemon
2023-06-01 10:39:48 +08:00
parent 6ccfd5f7cf
commit bc32bd8238
6 changed files with 133 additions and 9 deletions

View File

@@ -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();
}
/**