LocalTime.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 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/LocalTime;", "", ApiSince=26)]
public Java.Time.LocalTime? With(Java.Time.Temporal.ITemporalAdjuster? adjuster);
[<Android.Runtime.Register("with", "(Ljava/time/temporal/TemporalAdjuster;)Ljava/time/LocalTime;", "", ApiSince=26)>]
member this.With : Java.Time.Temporal.ITemporalAdjuster -> Java.Time.LocalTime
Parameters
- adjuster
- ITemporalAdjuster
the adjuster to use, not null
Returns
a LocalTime based on this with the adjustment made, not null
- Attributes
Remarks
Returns an adjusted copy of this time. This returns a LocalTime, 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 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.LocalTime.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/LocalTime;", "", 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/LocalTime;", "", 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 LocalTime 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 a LocalTime, 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 supported fields behave as follows: NANO_OF_SECOND - Returns a LocalTime with the specified nano-of-second. The hour, minute and second will be unchanged. NANO_OF_DAY - Returns a LocalTime with the specified nano-of-day. This completely replaces the time and is equivalent to ofNanoOfDay(long). MICRO_OF_SECOND - Returns a LocalTime with the nano-of-second replaced by the specified micro-of-second multiplied by 1,000. The hour, minute and second will be unchanged. MICRO_OF_DAY - Returns a LocalTime with the specified micro-of-day. This completely replaces the time and is equivalent to using ofNanoOfDay(long) with the micro-of-day multiplied by 1,000. MILLI_OF_SECOND - Returns a LocalTime with the nano-of-second replaced by the specified milli-of-second multiplied by 1,000,000. The hour, minute and second will be unchanged. MILLI_OF_DAY - Returns a LocalTime with the specified milli-of-day. This completely replaces the time and is equivalent to using ofNanoOfDay(long) with the milli-of-day multiplied by 1,000,000. SECOND_OF_MINUTE - Returns a LocalTime with the specified second-of-minute. The hour, minute and nano-of-second will be unchanged. SECOND_OF_DAY - Returns a LocalTime with the specified second-of-day. The nano-of-second will be unchanged. MINUTE_OF_HOUR - Returns a LocalTime with the specified minute-of-hour. The hour, second-of-minute and nano-of-second will be unchanged. MINUTE_OF_DAY - Returns a LocalTime with the specified minute-of-day. The second-of-minute and nano-of-second will be unchanged. HOUR_OF_AMPM - Returns a LocalTime with the specified hour-of-am-pm. The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged. CLOCK_HOUR_OF_AMPM - Returns a LocalTime with the specified clock-hour-of-am-pm. The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged. HOUR_OF_DAY - Returns a LocalTime with the specified hour-of-day. The minute-of-hour, second-of-minute and nano-of-second will be unchanged. CLOCK_HOUR_OF_DAY - Returns a LocalTime with the specified clock-hour-of-day. The minute-of-hour, second-of-minute and nano-of-second will be unchanged. AMPM_OF_DAY - Returns a LocalTime with the specified AM/PM. The hour-of-am-pm, minute-of-hour, second-of-minute and nano-of-second 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.LocalTime.with.