From be67478cae6bf9308f15949a21e7d0a57a3f0ecb Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 16 七月 2020 15:37:31 +0800 Subject: [PATCH] dubbo集成修改 --- utils/src/main/java/org/yeshi/utils/DateUtil.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 52 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 0b84ec1..4d4978c 100644 --- a/utils/src/main/java/org/yeshi/utils/DateUtil.java +++ b/utils/src/main/java/org/yeshi/utils/DateUtil.java @@ -336,6 +336,13 @@ return ca.getTime(); } + public static Date reduceDay(Date currdate, int num) { + Calendar ca = Calendar.getInstance(); + ca.setTime(currdate); + ca.add(Calendar.DATE, -num); + return ca.getTime(); + } + /** * 鎸囧畾鏃ユ湡鍑忓幓澶╂暟鍚庣殑鏃ユ湡 * @@ -628,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