Skip to content

Calendar.SubtractAsync

Overview

Promise<Number> Calendar.SubtractAsync ( start, end, [callback] )
Returns the difference between the specified start and end date time values in hours.

Arguments

DateTimeOffset start Specifies the start date time value.

DateTimeOffset end Specifies the end date time value.

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 $Calendar2 object.

Examples

$Calendar.SubtractAsync(new DateTimeOffset(), $Xml.EvaluateDateTime('NextTime')).then(function(hours) {
    $Xml.SetValue('Days', hours / 9);
});

Result is

<Days>5</Days>

See Also