Formatting a Duration in Java 8 / jsr310
Java 9 and later: Duration::to…Part methods In Java 9 the Duration class gained new to…Part methods for returning the various parts of days, hours, minutes, seconds, milliseconds/nanoseconds. See this pre-release OpenJDK source code. Given a duration of 49H30M20.123S… toNanosPart() = 123000000 toMillisPart() = 123 toSecondsPart() = 20 toMinutesPart() = 30 toHoursPart() = 1 toDaysPart() = … Read more