From 84d1c713f5275b77083efdd00e616f3181f64d37 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 07 六月 2024 15:04:46 +0800
Subject: [PATCH] 修复bug
---
server/dmvisit_service/src/main/java/com/doumee/core/utils/DateUtil.java | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/server/dmvisit_service/src/main/java/com/doumee/core/utils/DateUtil.java b/server/dmvisit_service/src/main/java/com/doumee/core/utils/DateUtil.java
index 62a16ad..2ccb323 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/core/utils/DateUtil.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -50,7 +50,7 @@
try {
TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
//TimeZone tz = TimeZone.getTimeZone("GMT-01");
- DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+'z");
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+'08:00");
df.setTimeZone(tz);
String nowAsISO = df.format(date);
return nowAsISO;
@@ -431,6 +431,19 @@
if (date == null)
return "";
+ try {
+ String nowDate = sdfLong.format(date);
+ return nowDate;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+ public static String getShortTimeToNull(Date date) {
+
+ if (date == null)
+ return null;
try {
String nowDate = sdfLong.format(date);
return nowDate;
@@ -1361,7 +1374,6 @@
}
int nday = caln.get(Calendar.DAY_OF_YEAR);
days = days + nday - oday;
-
return days;
}
@@ -2823,11 +2835,9 @@
public static void main(String[] args) {
try {
- System.out.println(RandomStringUtils.randomNumeric(3));
- Date date = getISO8601DateByStr("2024-02-21T15:46:36.014+08:00");
- System.out.println(getISO8601Timestamp(date));
-
-
+ 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(daysBetweenDates11(date1,date)+1);
} catch (Exception ex) {
ex.printStackTrace();
--
Gitblit v1.9.3