IChronoPeriod.AddTo(ITemporal) Method

Definition

Adds this period to the specified temporal object.

[Android.Runtime.Register("addTo", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "GetAddTo_Ljava_time_temporal_Temporal_Handler:Java.Time.Chrono.IChronoPeriodInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public Java.Time.Temporal.ITemporal? AddTo (Java.Time.Temporal.ITemporal? temporal);
[<Android.Runtime.Register("addTo", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "GetAddTo_Ljava_time_temporal_Temporal_Handler:Java.Time.Chrono.IChronoPeriodInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member AddTo : Java.Time.Temporal.ITemporal -> Java.Time.Temporal.ITemporal

Parameters

temporal
ITemporal

the temporal object to adjust, not null

Returns

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

Implements

Attributes

Remarks

Adds this period to the specified temporal object.

This returns a temporal object of the same observable type as the input with this period added.

In most cases, it is clearer to reverse the calling pattern by using Temporal#plus(TemporalAmount).

// these two lines are equivalent, but the second approach is recommended
              dateTime = thisPeriod.addTo(dateTime);
              dateTime = dateTime.plus(thisPeriod);

The specified temporal must have the same chronology as this period. This returns a temporal with the non-zero supported units added.

This instance is immutable and unaffected by this method call.

Java documentation for java.time.chrono.ChronoPeriod.addTo(java.time.temporal.Temporal).

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