From d352184d3364e379da38e56d6aa53c1f53f517ca Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期日, 04 一月 2026 15:06:59 +0800
Subject: [PATCH] 最新版本541200007最新版本541200007
---
server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java | 40 ++++++----------------------------------
1 files changed, 6 insertions(+), 34 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 d989500..d27f3b5 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
@@ -16,7 +16,6 @@
import cn.hutool.core.date.DateUnit;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
-
/**
* 鏃ユ湡宸ュ叿绫�
* @author: jiangping
@@ -93,10 +92,11 @@
Date nowAsISO = null;
try {
nowAsISO = df.parse(date);
- } catch (ParseException e) {
+ } catch (Exception e) {
}
return nowAsISO;
}
+
public static Date getISO8601DateByStr2(String date) {
TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
if(date!=null ){
@@ -112,7 +112,7 @@
Date nowAsISO = null;
try {
nowAsISO = df.parse(date);
- } catch (ParseException e) {
+ } catch (Exception e) {
}
return nowAsISO;
}
@@ -2968,35 +2968,7 @@
public static void main(String[] args) {
try {
-// Date date = getISO8601DateByStr("2024-04-15T07:46:36.014+08:00");
-// Date date1 = getISO8601DateByStr("2024-06-14T08:46:36.014+08:00");
-// System.out.println(DateUtil.afterMinutesDate(-5));
-
- System.out.println(DateUtil.getFirstThisMonthDate());
-
-// System.out.println(getPlusTime2(DateUtil.addMonthToDate(new Date(),-1)));
-// System.out.println(DateUtil.getBeforMonthStr(new Date(),12));
-
-// List<Date> list =getThisMonthDateList();
-// for(Date d :list){
-// System.out.println(getPlusTime2(d));
-// }
-// List<Date> list1 =getThisYearMonthList();
-// for(Date d :list1){
-// System.out.println(getPlusTime2(d));
-// }
-
-// Date startTime = DateUtil.StringToDate("2024-05-01 08:00:00" ,"yyyy-MM-dd HH:mm:ss");
-// Date endTime = DateUtil.StringToDate("2024-05-01 17:00:00" ,"yyyy-MM-dd HH:mm:ss");
-// Long intervalTime = 35L;
-//
-//
-// DateUtil.checkDateInterval( startTime.toInstant()
-// .atZone(ZoneId.systemDefault())
-// .toLocalDateTime(), endTime.toInstant()
-// .atZone(ZoneId.systemDefault())
-// .toLocalDateTime(),intervalTime);
-
+ System.out.println(getISO8601DateByStr("2025-12-26T03:08:39.123Z"));
} catch (Exception ex) {
ex.printStackTrace();
}
@@ -3114,7 +3086,6 @@
String temp = sdf.format(date);
String firstDayInMoth = "";
firstDayInMoth = temp + "-01";
-
return firstDayInMoth;
}
@@ -3147,7 +3118,8 @@
*/
public static String getWeekZhouOfDate(Date dt) {
String[] weekDays = { "鍛ㄦ棩", "鍛ㄤ竴", "鍛ㄤ簩", "鍛ㄤ笁", "鍛ㄥ洓", "鍛ㄤ簲", "鍛ㄥ叚" };
- Calendar cal = Calendar.getInstance();
+ TimeZone china = TimeZone.getTimeZone("Asia/Shanghai");
+ Calendar cal = Calendar.getInstance(china);
cal.setTime(dt);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
--
Gitblit v1.9.3