@Test
public void timeDifference() {
LocalDateTime tomorrow = LocalDateTime.of(LocalDateTime.now().toLocalDate().plusDays(1), LocalTime.of(0, 0));
Duration duration = Duration.between(LocalDateTime.now(), tomorrow);
long totalHours = duration.toHours();
System.err.println(totalHours + "小时" + duration.minusHours(totalHours).toMinutes() + "分钟!");
}
计算LocalDateTime时间差
最新推荐文章于 2024-05-24 02:08:26 发布