修复开始时间和结束时间写反问题

This commit is contained in:
yosixiaohu
2025-05-22 13:50:06 +08:00
parent 2dcd070fbe
commit 83f603238a

View File

@@ -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);
}
}