Language

IChronoLocalDate.ITemporal.With Method

Definition

Overloads

Name Description
ITemporal.With(ITemporalField, Int64)

Returns an object of the same type as this object with the specified field altered.

ITemporal.With(ITemporalAdjuster)

Returns an adjusted object of the same type as this object with the adjustment made.

ITemporal.With(ITemporalField, Int64)

Returns an object of the same type as this object with the specified field altered.

[Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalField;J)Ljava/time/chrono/ChronoLocalDate;", "GetWith_Ljava_time_temporal_TemporalField_JHandler:Java.Time.Chrono.IChronoLocalDate, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
override sealed Java.Time.Temporal.ITemporal? ITemporal.With(Java.Time.Temporal.ITemporalField? field, long newValue);
[<Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalField;J)Ljava/time/chrono/ChronoLocalDate;", "GetWith_Ljava_time_temporal_TemporalField_JHandler:Java.Time.Chrono.IChronoLocalDate, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member Java.Time.Temporal.ITemporal.With : Java.Time.Temporal.ITemporalField * int64 -> Java.Time.Temporal.ITemporal
override this.Java.Time.Temporal.ITemporal.With : Java.Time.Temporal.ITemporalField * int64 -> Java.Time.Temporal.ITemporal

Parameters

field
ITemporalField

the field to set in the result, not null

newValue
Int64

the new value of the field in the result

Returns

an object of the same type with the specified field set, not null

Implements

Attributes

Remarks

Returns an object of the same type as this object with the specified field altered. This returns a new object based on this one with the value for the specified field changed. For example, on a LocalDate, this could be used to set the year, month or day-of-month. The returned object will have the same observable type as this object. In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then changing the month to February would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.

Java documentation for java.time.chrono.ChronoLocalDate.with(java.time.temporal.TemporalField, long).

Java reference for java.time.chrono.ChronoLocalDate.with.

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.

Applies to

ITemporal.With(ITemporalAdjuster)

Returns an adjusted object of the same type as this object with the adjustment made.

[Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalAdjuster;)Ljava/time/chrono/ChronoLocalDate;", "GetWith_Ljava_time_temporal_TemporalAdjuster_Handler:Java.Time.Chrono.IChronoLocalDate, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
override sealed Java.Time.Temporal.ITemporal? ITemporal.With(Java.Time.Temporal.ITemporalAdjuster? adjuster);
[<Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalAdjuster;)Ljava/time/chrono/ChronoLocalDate;", "GetWith_Ljava_time_temporal_TemporalAdjuster_Handler:Java.Time.Chrono.IChronoLocalDate, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member Java.Time.Temporal.ITemporal.With : Java.Time.Temporal.ITemporalAdjuster -> Java.Time.Temporal.ITemporal
override this.Java.Time.Temporal.ITemporal.With : Java.Time.Temporal.ITemporalAdjuster -> Java.Time.Temporal.ITemporal

Parameters

adjuster
ITemporalAdjuster

the adjuster to use, not null

Returns

an object of the same type with the specified adjustment made, not null

Implements

Attributes

Remarks

Returns an adjusted object of the same type as this object with the adjustment made. This adjusts this date-time according to the rules of the specified adjuster. A simple adjuster might simply set the one of the fields, such as the year field. A more complex adjuster might set the date to the last day of the month. A selection of common adjustments is provided in TemporalAdjusters. These include finding the "last day of the month" and "next Wednesday". The adjuster is responsible for handling special cases, such as the varying lengths of month and leap years.

date = date.with(Month.JULY);        // most key classes implement TemporalAdjuster
date = date.with(lastDayOfMonth());  // static import from Adjusters
date = date.with(next(WEDNESDAY));   // static import from Adjusters and DayOfWeek

Java documentation for java.time.chrono.ChronoLocalDate.with(java.time.temporal.TemporalAdjuster).

Java reference for java.time.chrono.ChronoLocalDate.with.

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.

Applies to