Duration.of

Obtains a {@code Duration} representing an amount _in the specified unit. !(p) The parameters represent the two parts of a phrase like '6 Hours'. For example: !(pre) Duration.of(3, SECONDS); Duration.of(465, HOURS); </pre> Only a subset of units are accepted by this method. The unit must either have an {@linkplain TemporalUnit#isDurationEstimated() exact duration} or be {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception.

@param amount the amount of the duration, measured _in terms of the unit, positive or negative @param unit the unit that the duration is measured _in, must have an exact duration, not null @return a {@code Duration}, not null @throws DateTimeException if the period unit has an estimated duration @throws ArithmeticException if a numeric overflow occurs

class Duration
static
of

Meta