From 4df9fdf92a0a3461d53a08d797a63145af48e0c6 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期四, 19 九月 2024 14:08:15 +0800 Subject: [PATCH] 代码初始化 --- server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 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 11635cf..fbd64de 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 @@ -1823,14 +1823,6 @@ // StringUtil.getNotNullStr(request.getParameter(strParamName)); // return getDateByString(strStr); // } - /** - * 寰楀埌褰撳墠鏃ユ湡锛屾牸寮弝yyy-MM-dd銆� - * - * @return String 鏍煎紡鍖栫殑鏃ユ湡瀛楃涓� - */ - public static String getCurrDate() { - return getFormattedDate(getDateByString("")); - } /** * 寰楀埌褰撳墠鏃ユ湡锛屾牸寮弝yyy-MM-dd銆� @@ -1893,6 +1885,17 @@ public static String getCurrDateTime() { Timestamp date = new Timestamp(System.currentTimeMillis()); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + return formatter.format(date); + } + + /** + * 寰楀埌褰撳墠鏃ユ湡鏃堕棿,鏍煎紡涓簓yyy-MM-dd. + * + * @return String + */ + public static String getCurrDate() { + Timestamp date = new Timestamp(System.currentTimeMillis()); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); return formatter.format(date); } @@ -2968,6 +2971,13 @@ return DateToStr(date, "yyyyMMdd"); } + public static String afterDateHourToStr(Integer hour){ + Date date = new Date(); + Long l = date.getTime()+1000*60*60*hour; + date.setTime(l); + return DateToStr(date, "yyyyMMdd"); + } + public static String beforeDateToStr(Integer days){ Date date = new Date(); Long l = date.getTime()-1000*60*60*24*days; -- Gitblit v1.9.3