Language

LocalDateTime.TruncatedTo(ITemporalUnit) Method

Definition

Returns a copy of this LocalDateTime with the time truncated.

[Android.Runtime.Register("truncatedTo", "(Ljava/time/temporal/TemporalUnit;)Ljava/time/LocalDateTime;", "", ApiSince=26)]
public Java.Time.LocalDateTime? TruncatedTo(Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("truncatedTo", "(Ljava/time/temporal/TemporalUnit;)Ljava/time/LocalDateTime;", "", ApiSince=26)>]
member this.TruncatedTo : Java.Time.Temporal.ITemporalUnit -> Java.Time.LocalDateTime

Parameters

unit
ITemporalUnit

the unit to truncate to, not null

Returns

a LocalDateTime based on this date-time with the time truncated, not null

Attributes

Remarks

Returns a copy of this LocalDateTime with the time truncated. Truncation rounds the time down to a multiple of the unit within a standard day. For example, truncating with the minutes unit will set the second-of-minute and nano-of-second field to zero. 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.

Java reference for java.time.LocalDateTime.truncatedTo.

Applies to