From acad524bfb7f376c09ff8e6600fab207780156e1 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期四, 23 十一月 2023 18:46:05 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai --- 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..1cd88bd 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