From c338aa60df58bee9f4c25afedf94fe6930a119c1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 29 七月 2020 19:01:56 +0800 Subject: [PATCH] SpringContext中的循环任务优化,添加业务监控 --- 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