From 83f603238ae4a9d666a655dcc9d131b62dbe6154 Mon Sep 17 00:00:00 2001 From: yosixiaohu <1632740646@qq.com> Date: Thu, 22 May 2025 13:50:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=A7=8B=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=92=8C=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E5=86=99?= =?UTF-8?q?=E5=8F=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/utils/DateUtil.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java index 24a6b3782..860348114 100755 --- a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java @@ -195,6 +195,14 @@ public class DateUtil { } Instant startInstant = Instant.from(formatter.parse(startTime)); Instant endInstant = Instant.from(formatter.parse(endTime)); - return ChronoUnit.MILLIS.between(endInstant, startInstant); + return ChronoUnit.MILLIS.between(startInstant, endInstant); } + + + + public static void main(String[] args) { + long difference = getDifference("2025-05-21 13:00:00", "2025-05-21 13:30:00")/1000; + System.out.println(difference); + } + }