From 701d5ca0fb3da20fb336d66e08f4aa3c6b85c731 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期五, 29 十一月 2024 09:37:37 +0800 Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit --- server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java b/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java index 5ca5eba..f36958d 100644 --- a/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java +++ b/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java @@ -460,7 +460,7 @@ * @return String * @throws Exception */ - public static String getPlusTime(Date date) throws Exception { + public static String getPlusTime(Date date) { if (date == null) return null; try { @@ -1283,6 +1283,9 @@ * @return */ public static Date getXMinuteAfterDate(Date date, int minute) { + if(date ==null){ + date = new Date(); + } Calendar now = Calendar.getInstance(); now.setTime(date); now.set(Calendar.MINUTE, now.get(Calendar.MINUTE) + minute); @@ -1631,6 +1634,13 @@ public static String getFirstDayOfThisMonth() { try { return getNowShortDate().substring(0, 6) + "01"; + } catch (Exception e) { + return ""; + } + } + public static String getFirstDayCurrentMonth() { + try { + return getDateLong(new Date()).substring(0, 7) + "-01"; } catch (Exception e) { return ""; } @@ -3026,6 +3036,12 @@ calendar.add(Calendar.DATE, days);// return calendar.getTime(); } + public static Date addMonthToDate(Date date, int month) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, month);// + return calendar.getTime(); + } public static String afterDateToStr(Integer days){ Date date = new Date(); -- Gitblit v1.9.3