Year.With 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.
Overloads
| Name | Description |
|---|---|
| With(ITemporalAdjuster) |
Returns an adjusted copy of this year. |
| With(ITemporalField, Int64) |
Returns a copy of this year with the specified field set to a new value. |
With(ITemporalAdjuster)
Returns an adjusted copy of this year.
[Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalAdjuster;)Ljava/time/Year;", "", ApiSince=26)]
public Java.Time.Year? With(Java.Time.Temporal.ITemporalAdjuster? adjuster);
[<Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalAdjuster;)Ljava/time/Year;", "", ApiSince=26)>]
member this.With : Java.Time.Temporal.ITemporalAdjuster -> Java.Time.Year
Parameters
- adjuster
- ITemporalAdjuster
the adjuster to use, not null
Returns
a Year based on this with the adjustment made, not null
- Attributes
Remarks
Returns an adjusted copy of this year. This returns a Year, based on this one, with the year adjusted. The adjustment takes place using the specified adjuster strategy object. Read the documentation of the adjuster to understand what adjustment will be made. The result of this method is obtained by invoking the TemporalAdjuster.adjustInto(Temporal) method on the specified adjuster passing this as the argument. This instance is immutable and unaffected by this method call.
Java reference for java.time.Year.with.
Applies to
With(ITemporalField, Int64)
Returns a copy of this year with the specified field set to a new value.
[Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalField;J)Ljava/time/Year;", "", ApiSince=26)]
public Java.Time.Temporal.ITemporal? With(Java.Time.Temporal.ITemporalField? field, long newValue);
[<Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalField;J)Ljava/time/Year;", "", ApiSince=26)>]
abstract member With : Java.Time.Temporal.ITemporalField * int64 -> Java.Time.Temporal.ITemporal
override this.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
a Year based on this with the specified field set, not null
Implements
- Attributes
Remarks
Returns a copy of this year with the specified field set to a new value. This returns a Year, based on this one, with the value for the specified field changed. If it is not possible to set the value, because the field is not supported or for some other reason, an exception is thrown. If the field is a ChronoField then the adjustment is implemented here. The supported fields behave as follows: YEAR_OF_ERA - Returns a Year with the specified year-of-era The era will be unchanged. YEAR - Returns a Year with the specified year. This completely replaces the date and is equivalent to of(int). ERA - Returns a Year with the specified era. The year-of-era will be unchanged. In all cases, if the new value is outside the valid range of values for the field then a DateTimeException will be thrown. All other ChronoField instances will throw an UnsupportedTemporalTypeException. If the field is not a ChronoField, then the result of this method is obtained by invoking TemporalField.adjustInto(Temporal, long) passing this as the argument. In this case, the field determines whether and how to adjust the instant. This instance is immutable and unaffected by this method call.
Java reference for java.time.Year.with.