Period.SubtractFrom(ITemporal) Method

Definition

Subtracts this period from the specified temporal object.

[Android.Runtime.Register("subtractFrom", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "", 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;", "", ApiSince=26)>]
abstract member SubtractFrom : Java.Time.Temporal.ITemporal -> Java.Time.Temporal.ITemporal
override this.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. If the temporal has a chronology, it must be the ISO chronology. In most cases, it is clearer to reverse the calling pattern by using Temporal.minus(TemporalAmount). The calculation operates as follows. First, the chronology of the temporal is checked to ensure it is ISO chronology or null. Second, if the months are zero, the years are subtracted if non-zero, otherwise the combination of years and months is subtracted if non-zero. Finally, any days are subtracted. This approach ensures that a partial period can be subtracted from a partial date. For example, a period of years and/or months can be subtracted from a YearMonth, but a period including days cannot. The approach also subtracts years and months together when necessary, which ensures correct behaviour at the end of the month. This instance is immutable and unaffected by this method call.

Java reference for java.time.Period.subtractFrom.

Applies to