Duration.AddTo(ITemporal) 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.
Adds this duration to the specified temporal object.
[Android.Runtime.Register("addTo", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "", ApiSince=26)]
public Java.Time.Temporal.ITemporal? AddTo(Java.Time.Temporal.ITemporal? temporal);
[<Android.Runtime.Register("addTo", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "", ApiSince=26)>]
abstract member AddTo : Java.Time.Temporal.ITemporal -> Java.Time.Temporal.ITemporal
override this.AddTo : Java.Time.Temporal.ITemporal -> Java.Time.Temporal.ITemporal
Parameters
- temporal
- ITemporal
the temporal object to adjust, not null
Returns
an object of the same type with the adjustment made, not null
Implements
- Attributes
Remarks
Adds this duration to the specified temporal object. This returns a temporal object of the same observable type as the input with this duration added. In most cases, it is clearer to reverse the calling pattern by using Temporal.plus(TemporalAmount).
// these two lines are equivalent, but the second approach is recommended
dateTime = thisDuration.addTo(dateTime);
dateTime = dateTime.plus(thisDuration);
The calculation will add the seconds, then nanos. Only non-zero amounts will be added. This instance is immutable and unaffected by this method call.
Java reference for java.time.Duration.addTo.