LocalDateTime.Minus Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| Minus(ITemporalAmount) |
Returns a copy of this date-time with the specified amount subtracted. |
| Minus(Int64, ITemporalUnit) |
Returns a copy of this date-time with the specified amount subtracted. |
Minus(ITemporalAmount)
Returns a copy of this date-time with the specified amount subtracted.
[Android.Runtime.Register("minus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/LocalDateTime;", "", ApiSince=26)]
public Java.Time.LocalDateTime? Minus(Java.Time.Temporal.ITemporalAmount? amountToSubtract);
[<Android.Runtime.Register("minus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/LocalDateTime;", "", ApiSince=26)>]
member this.Minus : Java.Time.Temporal.ITemporalAmount -> Java.Time.LocalDateTime
Parameters
- amountToSubtract
- ITemporalAmount
the amount to subtract, not null
Returns
a LocalDateTime based on this date-time with the subtraction made, not null
- Attributes
Remarks
Returns a copy of this date-time with the specified amount subtracted. The amount is typically Period or Duration but may be any other type implementing the TemporalAmount interface. For a Period, the date is adjusted and the time is unchanged. For other amounts, the method calls TemporalAmount.subtractFrom(Temporal). The amount implementation determines how to perform the subtraction. 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.
Java reference for java.time.LocalDateTime.minus.
Applies to
Minus(Int64, ITemporalUnit)
Returns a copy of this date-time with the specified amount subtracted.
[Android.Runtime.Register("minus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/LocalDateTime;", "", ApiSince=26)]
public Java.Time.LocalDateTime? Minus(long amountToSubtract, Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("minus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/LocalDateTime;", "", ApiSince=26)>]
member this.Minus : int64 * Java.Time.Temporal.ITemporalUnit -> Java.Time.LocalDateTime
Parameters
- amountToSubtract
- Int64
the amount of the unit to subtract from the result, may be negative
- unit
- ITemporalUnit
the unit of the amount to subtract, not null
Returns
a LocalDateTime based on this date-time with the specified amount subtracted, not null
- Attributes
Remarks
Returns a copy of this date-time with the specified amount subtracted. This returns a LocalDateTime, 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. Unless the amount is MinValue, this method calls plus(long, TemporalUnit) with the amount negated. For MinValue, it calls plus with MaxValue, then calls plus with one on the result. See the addition method for how the unit is handled. This instance is immutable and unaffected by this method call.
Java reference for java.time.LocalDateTime.minus.