Duration.Of(Int64, ITemporalUnit) Method

Definition

Obtains a Duration representing an amount in the specified unit.

[Android.Runtime.Register("of", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/Duration;", "", ApiSince=26)]
public static Java.Time.Duration? Of(long amount, Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("of", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/Duration;", "", ApiSince=26)>]
static member Of : int64 * Java.Time.Temporal.ITemporalUnit -> Java.Time.Duration

Parameters

amount
Int64

the amount of the duration, measured in terms of the unit, positive or negative

unit
ITemporalUnit

the unit that the duration is measured in, must have an exact duration, not null

Returns

a Duration, not null

Attributes

Remarks

Obtains a Duration representing an amount in the specified unit. The parameters represent the two parts of a phrase like '6 Hours'. For example: Only a subset of units are accepted by this method. The unit must either have an exact duration or be ChronoUnit.DAYS which is treated as 24 hours. Other units throw an exception.

Java reference for java.time.Duration.of.

Applies to