Duration.TruncatedTo(ITemporalUnit) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a copy of this Duration truncated to the specified unit.
[Android.Runtime.Register("truncatedTo", "(Ljava/time/temporal/TemporalUnit;)Ljava/time/Duration;", "", ApiSince=31)]
public Java.Time.Duration? TruncatedTo(Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("truncatedTo", "(Ljava/time/temporal/TemporalUnit;)Ljava/time/Duration;", "", ApiSince=31)>]
member this.TruncatedTo : Java.Time.Temporal.ITemporalUnit -> Java.Time.Duration
Parameters
- unit
- ITemporalUnit
the unit to truncate to, not null
Returns
a Duration based on this duration with the time truncated, not null
- Attributes
Remarks
Returns a copy of this Duration truncated to the specified unit. 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 MINUTES unit will round down towards zero to the nearest minute, setting the seconds and nanoseconds to zero. The unit must have a duration that divides into the length of a standard day without remainder. This includes all time-based units on ChronoUnit and DAYS. Other ChronoUnits throw an exception. This instance is immutable and unaffected by this method call.
Java reference for java.time.Duration.truncatedTo.