From ec60e757d358636dcac1589c44a66f3e276fe58c Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期一, 29 六月 2020 14:41:42 +0800 Subject: [PATCH] 拉新 --- utils/src/main/java/org/yeshi/utils/DateUtil.java | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 45 insertions(+), 1 deletions(-) diff --git a/utils/src/main/java/org/yeshi/utils/DateUtil.java b/utils/src/main/java/org/yeshi/utils/DateUtil.java index 915a83b..4d4978c 100644 --- a/utils/src/main/java/org/yeshi/utils/DateUtil.java +++ b/utils/src/main/java/org/yeshi/utils/DateUtil.java @@ -635,9 +635,53 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(cal.getTime()); } + + public static int getCurrentDate() { + Calendar cal = Calendar.getInstance(); + return cal.get(Calendar.DATE); + } + + public static int getCurrentMonth() { + Calendar cal = Calendar.getInstance(); + return cal.get(Calendar.MONTH) + 1; + } + + public static String getCurrentMonthChinese() { + Calendar cal = Calendar.getInstance(); + int month = cal.get(Calendar.MONTH) + 1; + + switch(month) { + case 1: + return "涓�"; + case 2: + return "浜�"; + case 3: + return "涓�"; + case 4: + return "鍥�"; + case 5: + return "浜�"; + case 6: + return "鍏�"; + case 7: + return "涓�"; + case 8: + return "鍏�"; + case 9: + return "涔�"; + case 10: + return "鍗�"; + case 11: + return "鍗佷竴"; + case 12: + return "鍗佷簩"; + default: + return "涓�"; + } + } public static void main(String[] args) throws ParseException { - System.out.println(getMonthSpace("2012-02", "2012-02")); + System.out.println(getCurrentDate()); } } \ No newline at end of file -- Gitblit v1.8.0