Instant.Minus Method

Definition

Overloads

Name Description
Minus(ITemporalAmount)

Returns a copy of this instant with the specified amount subtracted.

Minus(Int64, ITemporalUnit)

Returns a copy of this instant with the specified amount subtracted.

Minus(ITemporalAmount)

Returns a copy of this instant with the specified amount subtracted.

[Android.Runtime.Register("minus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/Instant;", "", ApiSince=26)]
public Java.Time.Instant? Minus(Java.Time.Temporal.ITemporalAmount? amountToSubtract);
[<Android.Runtime.Register("minus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/Instant;", "", ApiSince=26)>]
member this.Minus : Java.Time.Temporal.ITemporalAmount -> Java.Time.Instant

Parameters

amountToSubtract
ITemporalAmount

TemporalAmount: the amount to subtract, not null

Returns

an Instant based on this instant with the subtraction made, not null

Attributes

Remarks

Returns a copy of this instant with the specified amount subtracted. This returns an Instant, based on this one, with the specified amount subtracted. The amount is typically Duration but may be any other type implementing the TemporalAmount interface. The calculation is delegated to the amount object by calling TemporalAmount.subtractFrom(Temporal). The amount implementation is free to implement the subtraction in any way it wishes, however it typically calls back to minus(long,TemporalUnit). Consult the documentation of the amount implementation to determine if it can be successfully subtracted. This instance is immutable and unaffected by this method call.

Throws: ArithmeticException if numeric overflow occurs

Throws: DateTimeException if the subtraction cannot be made

Android reference for java.time.Instant.minus.

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

Minus(Int64, ITemporalUnit)

Returns a copy of this instant with the specified amount subtracted.

[Android.Runtime.Register("minus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/Instant;", "", ApiSince=26)]
public Java.Time.Instant? Minus(long amountToSubtract, Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("minus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/Instant;", "", ApiSince=26)>]
member this.Minus : int64 * Java.Time.Temporal.ITemporalUnit -> Java.Time.Instant

Parameters

amountToSubtract
Int64

long: the amount of the unit to subtract from the result, may be negative

unit
ITemporalUnit

TemporalUnit: the unit of the amount to subtract, not null

Returns

an Instant based on this instant with the specified amount subtracted, not null

Attributes

Remarks

Returns a copy of this instant with the specified amount subtracted. This returns an Instant, based on this one, with the amount in terms of the unit subtracted. If it is not possible to subtract the amount, because the unit is not supported or for some other reason, an exception is thrown. This method is equivalent to plus(long,TemporalUnit) with the amount negated. See that method for a full description of how addition, and thus subtraction, works. This instance is immutable and unaffected by this method call.

Throws: ArithmeticException if numeric overflow occurs

Throws: DateTimeException if the subtraction cannot be made

Throws: UnsupportedTemporalTypeException if the unit is not supported

Android reference for java.time.Instant.minus.

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