共用方式為


ITemporal.Plus Method

Definition

Overloads

Plus(ITemporalAmount)

Returns an object of the same type as this object with an amount added.

Plus(Int64, ITemporalUnit)

Returns an object of the same type as this object with the specified period added.

Plus(ITemporalAmount)

Returns an object of the same type as this object with an amount added.

[Android.Runtime.Register("plus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/temporal/Temporal;", "GetPlus_Ljava_time_temporal_TemporalAmount_Handler:Java.Time.Temporal.ITemporal, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public virtual Java.Time.Temporal.ITemporal? Plus (Java.Time.Temporal.ITemporalAmount? amount);
[<Android.Runtime.Register("plus", "(Ljava/time/temporal/TemporalAmount;)Ljava/time/temporal/Temporal;", "GetPlus_Ljava_time_temporal_TemporalAmount_Handler:Java.Time.Temporal.ITemporal, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member Plus : Java.Time.Temporal.ITemporalAmount -> Java.Time.Temporal.ITemporal
override this.Plus : Java.Time.Temporal.ITemporalAmount -> Java.Time.Temporal.ITemporal

Parameters

amount
ITemporalAmount

the amount to add, not null

Returns

an object of the same type with the specified adjustment made, not null

Attributes

Remarks

Returns an object of the same type as this object with an amount added.

This adjusts this temporal, adding according to the rules of the specified amount. The amount is typically a java.time.Period but may be any other type implementing the TemporalAmount interface, such as java.time.Duration.

Some example code indicating how and why this method is used:

date = date.plus(period);                // add a Period instance
             date = date.plus(duration);              // add a Duration instance
             date = date.plus(workingDays(6));        // example user-written workingDays method

Note that calling plus followed by minus is not guaranteed to return the same date-time.

Java documentation for java.time.temporal.Temporal.plus(java.time.temporal.TemporalAmount).

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

Plus(Int64, ITemporalUnit)

Returns an object of the same type as this object with the specified period added.

[Android.Runtime.Register("plus", "(JLjava/time/temporal/TemporalUnit;)Ljava/time/temporal/Temporal;", "GetPlus_JLjava_time_temporal_TemporalUnit_Handler:Java.Time.Temporal.ITemporalInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", 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/temporal/Temporal;", "GetPlus_JLjava_time_temporal_TemporalUnit_Handler:Java.Time.Temporal.ITemporalInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member Plus : int64 * Java.Time.Temporal.ITemporalUnit -> Java.Time.Temporal.ITemporal

Parameters

amountToAdd
Int64

the amount of the specified unit to add, may be negative

unit
ITemporalUnit

the unit of the amount to add, not null

Returns

an object of the same type with the specified period added, not null

Attributes

Remarks

Returns an object of the same type as this object with the specified period added.

This method returns a new object based on this one with the specified period added. For example, on a LocalDate, this could be used to add a number of years, months or days. The returned object will have the same observable type as this object.

In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then adding one month would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.

Java documentation for java.time.temporal.Temporal.plus(long, java.time.temporal.TemporalUnit).

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