Duration.truncatedTo

Returns a copy of this {@code Duration} truncated to the specified unit. !(p) Truncating the duration returns a copy of the original with conceptual fields smaller than the specified unit set to zero. For example, truncating with the {@link ChronoUnit#MINUTES MINUTES} unit will round down towards zero to the nearest minute, setting the seconds and nanoseconds to zero. !(p) The unit must have a {@linkplain TemporalUnit#getDuration() duration} that divides into the length of a standard day without remainder. This includes all {@linkplain ChronoUnit#isTimeBased() time-based units on {@code ChronoUnit}} and {@link ChronoUnit#DAYS DAYS}. Other ChronoUnits throw an exception. !(p) This instance is immutable and unaffected by this method call.

@param unit the unit to truncate to, not null @return a {@code Duration} based on this duration with the time truncated, not null @throws DateTimeException if the unit is invalid for truncation @throws UnsupportedTemporalTypeException if the unit is not supported @since 9

class Duration
truncatedTo

Meta