This commit is contained in:
Redkale
2018-12-24 14:52:05 +08:00
parent 33bd80c572
commit ee20a34a70

View File

@@ -940,6 +940,16 @@ public final class Utility {
return today.getYear() * 10000 + today.getMonthValue() * 100 + today.getDayOfMonth();
}
/**
* 获取当天151231格式的int值
*
* @return 151231格式的int值
*/
public static int todaySimple() {
java.time.LocalDate today = java.time.LocalDate.now();
return today.getYear() % 100 * 10000 + today.getMonthValue() * 100 + today.getDayOfMonth();
}
/**
* 获取昨天20151230格式的int值
*
@@ -951,6 +961,17 @@ public final class Utility {
return cal.get(Calendar.YEAR) * 10000 + (cal.get(Calendar.MONTH) + 1) * 100 + cal.get(Calendar.DAY_OF_MONTH);
}
/**
* 获取昨天151230格式的int值
*
* @return 151230格式的int值
*/
public static int yesterdaySimple() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -1);
return cal.get(Calendar.YEAR) % 100 * 10000 + (cal.get(Calendar.MONTH) + 1) * 100 + cal.get(Calendar.DAY_OF_MONTH);
}
/**
* 获取指定时间的20160202格式的int值
*