IChronoPeriod.SubtractFrom(ITemporal) Method

Definition

Subtracts this period from the specified temporal object.

[Android.Runtime.Register("subtractFrom", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "GetSubtractFrom_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? SubtractFrom (Java.Time.Temporal.ITemporal? temporal);
[<Android.Runtime.Register("subtractFrom", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "GetSubtractFrom_Ljava_time_temporal_Temporal_Handler:Java.Time.Chrono.IChronoPeriodInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member SubtractFrom : 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

Subtracts this period from the specified temporal object.

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

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

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

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

This instance is immutable and unaffected by this method call.

Java documentation for java.time.chrono.ChronoPeriod.subtractFrom(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