Skip to content

Calendar.AddTimeSpanAsync

Overview

Promise<DateTimeOffset> Calendar.AddTimeSpanAsync ( dateTime, time, [callback] )
Returns sum of specified dateTime and timespan string.

Arguments

DateTimeOffset dateTime Specifies the base date time value.

String time The time parameter is in the "d.hh🇲🇲ss" format

Function callback Callback to execute. Optional.

Remarks

Please make sure that you are using the right calendar object, since adding time is related with your calendar of choice. You can have more info on Calendar definitions by checking the $Calendar object.

Examples

//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