//下一个1分钟的秒数
LocalDateTime currentTime = LocalDateTime.now();
LocalDateTime nextMinute = currentTime.plusMinutes(1).truncatedTo(ChronoUnit.MINUTES);
long between = ChronoUnit.SECONDS.between(currentTime, nextMinute);
标签:秒数,currentTime,System,一分钟,五分钟,LocalDateTime,ChronoUnit From: https://www.cnblogs.com/carlors/p/17664229.html
//下一个五分钟的秒数
LocalDateTime currentTime = LocalDateTime.now();
LocalDateTime nextFiveMinute = currentTime.plusMinutes(5 - (currentTime.getMinute() % 5))
.truncatedTo(ChronoUnit.MINUTES);
long remainingTimeInSeconds = ChronoUnit.SECONDS.between(currentTime, nextFiveMinute);
System.out.println("当前时间: " + currentTime);
System.out.println("下一个五分钟的时间: " + nextFiveMinute);
System.out.println("剩余时间(秒): " + remainingTimeInSeconds);