Instant.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 Instant truncated to the specified unit.
[Android.Runtime.Register("truncatedTo", "(Ljava/time/temporal/TemporalUnit;)Ljava/time/Instant;", "", ApiSince=26)]
public Java.Time.Instant? TruncatedTo(Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("truncatedTo", "(Ljava/time/temporal/TemporalUnit;)Ljava/time/Instant;", "", ApiSince=26)>]
member this.TruncatedTo : Java.Time.Temporal.ITemporalUnit -> Java.Time.Instant
Parameters
- unit
- ITemporalUnit
TemporalUnit: the unit to truncate to, not null
Returns
an Instant based on this instant with the time truncated, not null
- Attributes
Remarks
Returns a copy of this Instant truncated to the specified unit. Truncation aligns the instant to a multiple of the unit within a standard day in UTC. For example, truncating a non-negative instant with the MINUTES unit rounds down to the nearest minute, setting the seconds and nanoseconds to zero. On some Android versions, truncating a negative instant can round toward the epoch instead. The unit must have a duration that divides into the length of a standard day without remainder. This includes all supplied time units on ChronoUnit and DAYS. Other ChronoUnit values throw an exception. This instance is immutable and unaffected by this method call.
Throws: DateTimeException if the unit is invalid for truncation
Throws: UnsupportedTemporalTypeException if the unit is not supported
Android reference for java.time.Instant.truncatedTo.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.