Overview
Returns the current date in the specified time zone asynchronously.
Promise<DateTimeOffset> Calendar.GetTodayAsync(timeZone: string)
Arguments
string timeZone
Specifies the target time zone for current date in "hh:mm" format. Optional, if not specified system timezone information is used.
You may use toISOString() method for comparisons on Xml Database. Such as;
Example
date comparison
Code Block |
---|
|
$Calendar.GetTodayAsync().then(function(today) {
if ( $Xml.Evaluate('OldDate') < today.toISOString() ) {
// ...
}
}); |
Example
Code Block |
---|
|
$Calendar.GetTodayAsync().then(function(date) {
$Xml.SetValue('Date1', date);
});
$Calendar.GetTodayAsync('02:00').then(function(date) {
$Xml.SetValue('Date2', date);
}); |
Example
Result it
Code Block |
---|
|
<Date1>2017-01-25T16:04:40.5625645Z</Date1>
<Date2>2017-01-25T18:04:40.5625645+02:00</Date2> |
Examples
date comparison
Code Block |
---|
|
$Calendar.GetTodayAsync().then(function(today) {
if ( $Xml.Evaluate('OldDate') < today.toISOString() ) {
// ...
}
}); |
Code Block |
---|
|
$Calendar.GetTodayAsync().then(function(date) {
$Xml.SetValue('Date1', date);
});
$Calendar.GetTodayAsync('02:00').then(function(date) {
$Xml.SetValue('Date2', date);
}); |
Result it
Code Block |
---|
|
<Date1>2017-01-25T16:04:40.5625645Z</Date1>
<Date2>2017-01-25T18:04:40.5625645+02:00</Date2> |