ZonedDateTime.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(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. |
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/ZonedDateTime;", "", ApiSince=26)]
public Java.Time.ZonedDateTime? Minus(long amountToSubtract, Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("minus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
member this.Minus : int64 * Java.Time.Temporal.ITemporalUnit -> Java.Time.ZonedDateTime
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 ZonedDateTime 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 ZonedDateTime, 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. For ChronoUnit, the calculation for date and time units differs. Date units operate on the local time-line. The period is first subtracted from the local date-time, then converted back to a zoned date-time using the zone ID. The conversion uses ofLocal(LocalDateTime, ZoneId, ZoneOffset) with the offset before the subtraction. Time units operate on the instant time-line. The period is first subtracted from the local date-time, then converted back to a zoned date-time using the zone ID. The conversion uses ofInstant(LocalDateTime, ZoneOffset, ZoneId) with the offset before the subtraction. Except for the minimum long value, this method calls plus(long, TemporalUnit) with the amount negated. For the minimum long value, it calls plus with the maximum long value, then calls plus again with one. See that method for a full description of how addition, and thus subtraction, works. This instance is immutable and unaffected by this method call.
Java reference for java.time.ZonedDateTime.minus.
Applies to
Minus(ITemporalAmount)
Returns a copy of this date-time with the specified amount subtracted.
[Android.Runtime.Register("minus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/ZonedDateTime;", "", ApiSince=26)]
public Java.Time.ZonedDateTime? Minus(Java.Time.Temporal.ITemporalAmount? amountToSubtract);
[<Android.Runtime.Register("minus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
member this.Minus : Java.Time.Temporal.ITemporalAmount -> Java.Time.ZonedDateTime
Parameters
- amountToSubtract
- ITemporalAmount
the amount to subtract, not null
Returns
a ZonedDateTime 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. This returns a ZonedDateTime, based on this one, 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 local date-time is adjusted and then resolved using the zone and existing offset. 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.ZonedDateTime.minus.