OffsetTime.With Method

Definition

Overloads

Name Description
With(ITemporalAdjuster)

Returns an adjusted copy of this time.

With(ITemporalField, Int64)

Returns a copy of this time with the specified field set to a new value.

With(ITemporalAdjuster)

Returns an adjusted copy of this time.

[Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalAdjuster;)Ljava/time/OffsetTime;", "", ApiSince=26)]
public Java.Time.OffsetTime? With(Java.Time.Temporal.ITemporalAdjuster? adjuster);
[<Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalAdjuster;)Ljava/time/OffsetTime;", "", ApiSince=26)>]
member this.With : Java.Time.Temporal.ITemporalAdjuster -> Java.Time.OffsetTime

Parameters

adjuster
ITemporalAdjuster

the adjuster to use, not null

Returns

an OffsetTime based on this with the adjustment made, not null

Attributes

Remarks

Returns an adjusted copy of this time. This returns an OffsetTime, based on this one, with the time adjusted. The adjustment takes place using the specified adjuster strategy object. Read the documentation of the adjuster to understand what adjustment will be made. A simple adjuster might simply set the one of the fields, such as the hour field. A more complex adjuster might set the time to the last hour of the day. The classes LocalTime and ZoneOffset implement TemporalAdjuster, thus this method can be used to change the time or offset: 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.OffsetTime.with.

Applies to

With(ITemporalField, Int64)

Returns a copy of this time with the specified field set to a new value.

[Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalField;J)Ljava/time/OffsetTime;", "", 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/OffsetTime;", "", 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

an OffsetTime based on this with the specified field set, not null

Implements

Attributes

Remarks

Returns a copy of this time with the specified field set to a new value. This returns an OffsetTime, based on this one, with the value for the specified field changed. This can be used to change any supported field, such as the hour, minute or second. 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 OFFSET_SECONDS field will return a time with the specified offset. The local time is unaltered. If the new offset value is outside the valid range then a DateTimeException will be thrown. The other supported fields will behave as per the matching method on LocalTime.with(TemporalField, long) LocalTime}. In this case, the offset is not part of the calculation and will be unchanged. 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.OffsetTime.with.

Applies to