Skip to content

AddTimeSpanAsync

Adds a specified time span to a DateTimeOffset value asynchronously.

1
myCalendar.AddTimeSpanAsync(dateTime: DateTimeOffset, time: string):Promise<DateTimeOffset>

Parameters

DateTimeOffset dateTime
    Specifies the base DateTimeOffset value.

string time
    The time span to add, in the "d.hh:mm:ss" format.

Returns

A Promise that resolves to a new DateTimeOffset value with the added time span.

Remarks

Ensure you are using the correct calendar object, as adding time is related to your calendar of choice. More information on calendar definitions can be found in the $Calendar object documentation.

Example

1
2
3
4
// Adds exactly 1 day, 2 hours, 30 minutes, and 45 seconds to the current time.
$Calendar.StandardCalendar.AddTimeSpanAsync(new DateTimeOffset(), '1.02:30:45').then(function(newDate) {
console.log(newDate);
});

See Also