From a78c2145e6aa9f7c0d29c992366c9b147f34908c Mon Sep 17 00:00:00 2001 From: Redkale <8730487+redkale@users.noreply.github.com> Date: Mon, 24 Dec 2018 17:16:39 +0800 Subject: [PATCH] --- src/org/redkale/util/Utility.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/org/redkale/util/Utility.java b/src/org/redkale/util/Utility.java index df2dc1b1b..c987b2458 100644 --- a/src/org/redkale/util/Utility.java +++ b/src/org/redkale/util/Utility.java @@ -945,7 +945,7 @@ public final class Utility { * * @return 151231格式的int值 */ - public static int todaySimple() { + public static int todayYYMMDD() { java.time.LocalDate today = java.time.LocalDate.now(); return today.getYear() % 100 * 10000 + today.getMonthValue() * 100 + today.getDayOfMonth(); } @@ -966,7 +966,7 @@ public final class Utility { * * @return 151230格式的int值 */ - public static int yesterdaySimple() { + public static int yesterdayYYMMDD() { 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); @@ -985,6 +985,19 @@ public final class Utility { return cal.get(Calendar.YEAR) * 10000 + (cal.get(Calendar.MONTH) + 1) * 100 + cal.get(Calendar.DAY_OF_MONTH); } + /** + * 获取指定时间的160202格式的int值 + * + * @param time 指定时间 + * + * @return 毫秒数 + */ + public static int yyMMdd(long time) { + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(time); + return cal.get(Calendar.YEAR) % 100 * 10000 + (cal.get(Calendar.MONTH) + 1) * 100 + cal.get(Calendar.DAY_OF_MONTH); + } + /** * 获取时间点所在星期的周一 *