public long get() {
Date currentDate = new Date();
// 明天00:00
LocalDateTime midnight = LocalDateTime.ofInstant(currentDate.toInstant(),
ZoneId.systemDefault()).plusDays(1).withHour(0).withMinute(0)
.withSecond(0).withNano(0);
// 当前时间
LocalDateTime currentDateTime = LocalDateTime.ofInstant(currentDate.toInstant(),
ZoneId.systemDefault());
long result = ChronoUnit.SECONDS.between(currentDateTime, midnight);
return result;
}
Java当中得到当前时间距离第二天凌晨还剩多少秒的统一写法
最新推荐文章于 2023-12-19 16:02:50 发布
关键词由CSDN通过智能技术生成