LocalDateTime.WithYear(Int32) Method

Definition

Returns a copy of this LocalDateTime with the year altered.

[Android.Runtime.Register("withYear", "(I)Ljava/time/LocalDateTime;", "", ApiSince=26)]
public Java.Time.LocalDateTime? WithYear(int year);
[<Android.Runtime.Register("withYear", "(I)Ljava/time/LocalDateTime;", "", ApiSince=26)>]
member this.WithYear : int -> Java.Time.LocalDateTime

Parameters

year
Int32

the year to set in the result, from MIN_YEAR to MAX_YEAR

Returns

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

Attributes

Remarks

Returns a copy of this LocalDateTime with the year altered. The time does not affect the calculation and will be the same in the result. If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. This instance is immutable and unaffected by this method call.

Java reference for java.time.LocalDateTime.withYear.

Applies to