Skip to content

Calendar.GetDateTimeAsync

Overview

Promise<DateTimeOffset> Calendar.GetDateTimeAsync ( [relativeDate], [offset], [callback] )
Returns a date time offset by relatively at specified offset.

Arguments

String relativeDate Relative date value. If set to empty or null, offset value is returned.

DateTimeOffset offset Offset date time value. If omitted current date time value is used.

Function callback Callback to execute. Optional.

Remarks

  • Please refer to Relative Date format for more information.
  • Relative date expression used to perform date calculation by relative points in time. Expression can be specified as following pattern;

[Amount] Unit, [ [Amount] Unit ], ....
You can find an example relative date expression in below.

2 Month, 3 Day
Following table can be used to specify units. Example current time as "2017-05-02T14:30:00+02:00"

Unit Description Example Result
Minute Minutes 5 Minute 2017-05-02T14:35:00+02:00
Hour Hours 4 Hour 2017-05-02T18:35:00+02:00
Day Days 2 Day 2017-05-04T14:30:00+02:00
BDay Beginning of Day 4 BDay 2017-05-08T00:00:00+02:00
EDay End of Day EDay 2017-05-02T23:59:59+02:00
Month Months 1 Month 2017-06-02T14:30:00+02:00
BMonth Beginning of Month 2 BMonth 2017-07-01T00:00:00+02:00
EMonth End of Month 1 EMonth 2017-06-30T23:59:59+02:00
Year Years 1 Year 2018-05-02T14:30:00+02:00
BYear Beginning of Year 2 BYear 2019-01-01T00:00:00+02:00
EYear End of Year EYear 2017-12-31T23:59:59+02:00

Examples

$Calendar.GetDateTimeAsync('BMonth').then(function(date) {
    $Xml.SetValue('Start',date);
});

$Calendar.GetDateTimeAsync('2 Day, 4 Hour').then(function(date) {
    $Xml.SetValue('End',date);
});

See Also