Udostępnij za pośrednictwem


ITemporalAmount.SubtractFrom(ITemporal) Method

Definition

Subtracts this object 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.Temporal.ITemporalAmountInvoker, 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.Temporal.ITemporalAmountInvoker, 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 subtract the amount from, not null

Returns

an object of the same observable type with the subtraction made, not null

Attributes

Remarks

Subtracts this object from the specified temporal object.

Subtracts the amount from the specified temporal object using the logic encapsulated in the implementing class.

There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use Temporal#minus(TemporalAmount):

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

It is recommended to use the second approach, minus(TemporalAmount), as it is a lot clearer to read in code.

Java documentation for java.time.temporal.TemporalAmount.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