Duration.From(ITemporalAmount) Method

Definition

Obtains an instance of Duration from a temporal amount.

[Android.Runtime.Register("from", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/Duration;", "", ApiSince=26)]
public static Java.Time.Duration? From(Java.Time.Temporal.ITemporalAmount? amount);
[<Android.Runtime.Register("from", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/Duration;", "", ApiSince=26)>]
static member From : Java.Time.Temporal.ITemporalAmount -> Java.Time.Duration

Parameters

amount
ITemporalAmount

the temporal amount to convert, not null

Returns

the equivalent duration, not null

Attributes

Remarks

Obtains an instance of Duration from a temporal amount. This obtains a duration based on the specified amount. A TemporalAmount represents an amount of time, which may be date-based or time-based, which this factory extracts to a duration. The conversion loops around the set of units from the amount and uses the duration of the unit to calculate the total Duration. 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. If any other units are found then an exception is thrown.

Java reference for java.time.Duration.from.

Applies to