Answers for "how to get time until next hour in java"

0

get time until start of next hour in java

LocalDateTime start = LocalDateTime.now();
    // Hour + 1, set Minute and Second to 00
    LocalDateTime end = start.plusHours(1).truncatedTo(ChronoUnit.HOURS);

    // Get Duration
    Duration duration = Duration.between(start, end);
    long millis = duration.toMillis();
Posted by: Guest on December-02-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language