From b21fb4c288c98971f9859cf5d85cef4c86e131bb Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期五, 08 十二月 2023 14:46:21 +0800
Subject: [PATCH] 12.8
---
cloud-server-other/src/main/java/com/dsh/other/util/DateComparisonExample.java | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/cloud-server-other/src/main/java/com/dsh/other/util/DateComparisonExample.java b/cloud-server-other/src/main/java/com/dsh/other/util/DateComparisonExample.java
index e48ab82..2a53815 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/util/DateComparisonExample.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/util/DateComparisonExample.java
@@ -30,4 +30,15 @@
return (valueStartDate.after(startDate) || valueStartDate.equals(startDate))
&& (valueEndDate.before(endDate) || valueEndDate.equals(endDate));
}
+
+ public static boolean isStringWithinTimeRange(String stringValue, Date startTime, Date endTime) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+ try {
+ Date dateValue = sdf.parse(stringValue);
+ return dateValue.after(startTime) && dateValue.before(endTime);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.7.1