LocalDate.Plus 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 |
|---|---|
| Plus(ITemporalAmount) |
Returns a copy of this date with the specified amount added. |
| Plus(Int64, ITemporalUnit) |
Returns a copy of this date with the specified amount added. |
Plus(ITemporalAmount)
Returns a copy of this date with the specified amount added.
[Android.Runtime.Register("plus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/LocalDate;", "", ApiSince=26)]
public Java.Time.LocalDate? Plus(Java.Time.Temporal.ITemporalAmount? amountToAdd);
[<Android.Runtime.Register("plus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/LocalDate;", "", ApiSince=26)>]
member this.Plus : Java.Time.Temporal.ITemporalAmount -> Java.Time.LocalDate
Parameters
- amountToAdd
- ITemporalAmount
the amount to add, not null
Returns
a LocalDate based on this date with the addition made, not null
- Attributes
Remarks
Returns a copy of this date with the specified amount added. This returns a LocalDate, based on this one, with the specified amount added. The amount is typically Period but may be any other type implementing the TemporalAmount interface. The calculation is delegated to the amount object by calling TemporalAmount.addTo(Temporal). The amount implementation is free to implement the addition in any way it wishes, however it typically calls back to plus(long, TemporalUnit). Consult the documentation of the amount implementation to determine if it can be successfully added. This instance is immutable and unaffected by this method call.
Java reference for java.time.LocalDate.plus.
Applies to
Plus(Int64, ITemporalUnit)
Returns a copy of this date with the specified amount added.
[Android.Runtime.Register("plus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/LocalDate;", "", ApiSince=26)]
public Java.Time.Temporal.ITemporal? Plus(long amountToAdd, Java.Time.Temporal.ITemporalUnit? unit);
[<Android.Runtime.Register("plus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/LocalDate;", "", ApiSince=26)>]
abstract member Plus : int64 * Java.Time.Temporal.ITemporalUnit -> Java.Time.Temporal.ITemporal
override this.Plus : int64 * Java.Time.Temporal.ITemporalUnit -> Java.Time.Temporal.ITemporal
Parameters
- amountToAdd
- Int64
the amount of the unit to add to the result, may be negative
- unit
- ITemporalUnit
the unit of the amount to add, not null
Returns
a LocalDate based on this date with the specified amount added, not null
Implements
- Attributes
Remarks
Returns a copy of this date with the specified amount added. This returns a LocalDate, based on this one, with the amount in terms of the unit added. If it is not possible to add the amount, because the unit is not supported or for some other reason, an exception is thrown. In some cases, adding the amount can cause the resulting date to become invalid. For example, adding one month to 31st January would result in 31st February. In cases like this, the unit is responsible for resolving the date. Typically it will choose the previous valid date, which would be the last valid day of February in this example. If the field is a ChronoUnit then the addition is implemented here. The supported fields behave as follows: DAYS - Returns a LocalDate with the specified number of days added. This is equivalent to plusDays(long). WEEKS - Returns a LocalDate with the specified number of weeks added. This is equivalent to plusWeeks(long) and uses a 7 day week. MONTHS - Returns a LocalDate with the specified number of months added. This is equivalent to plusMonths(long). The day-of-month will be unchanged unless it would be invalid for the new month and year. In that case, the day-of-month is adjusted to the maximum valid value for the new month and year. YEARS - Returns a LocalDate with the specified number of years added. This is equivalent to plusYears(long). The day-of-month will be unchanged unless it would be invalid for the new month and year. In that case, the day-of-month is adjusted to the maximum valid value for the new month and year. DECADES - Returns a LocalDate with the specified number of decades added. This is equivalent to calling plusYears(long) with the amount multiplied by 10. The day-of-month will be unchanged unless it would be invalid for the new month and year. In that case, the day-of-month is adjusted to the maximum valid value for the new month and year. CENTURIES - Returns a LocalDate with the specified number of centuries added. This is equivalent to calling plusYears(long) with the amount multiplied by 100. The day-of-month will be unchanged unless it would be invalid for the new month and year. In that case, the day-of-month is adjusted to the maximum valid value for the new month and year. MILLENNIA - Returns a LocalDate with the specified number of millennia added. This is equivalent to calling plusYears(long) with the amount multiplied by 1,000. The day-of-month will be unchanged unless it would be invalid for the new month and year. In that case, the day-of-month is adjusted to the maximum valid value for the new month and year. ERAS - Returns a LocalDate with the specified number of eras added. Only two eras are supported so the amount must be one, zero or minus one. If the amount is non-zero then the year is changed such that the year-of-era is unchanged. The day-of-month will be unchanged unless it would be invalid for the new month and year. In that case, the day-of-month is adjusted to the maximum valid value for the new month and year. All other ChronoUnit instances will throw an UnsupportedTemporalTypeException. If the field is not a ChronoUnit, then the result of this method is obtained by invoking TemporalUnit.addTo(Temporal, long) passing this as the argument. In this case, the unit determines whether and how to perform the addition. This instance is immutable and unaffected by this method call.
Java reference for java.time.LocalDate.plus.