Date and Time Expressions

Thu Jan 26 2021 11:00:00

While there is no dedicated Date or Time type, the following table describes the several convenience functions for working with Date and Time Strings:

Table 1. Date and Time

Expression

Description

DateUtcNow(): string

Returns the current date and time in Coordinated Universal Time (UTC).

DateUtcAddDay(date: string, daysToAdd: number): string

Returns the date/time by adding the specified number of days to the provided date/time.

DateUtcAddHour(date: string, hoursToAdd: number): string

Returns the date/time by adding the specified number of hours to the provided date/time.

DateUtcAddMinutes(date: string, minutesToAdd: number): string

Returns the date/time by adding the specified number of minutes to the provided date/time.

DateUtcAddSeconds(date: string, secondsToAdd: number): string

Returns the date/time by adding the specified number of seconds to the provided date/time.

DateUtcSubDay(date: string, daysToSub: number): string

Returns the date/time by subtracting the specified number of days from the provided date/time.

DateUtcSubHour(date: string, hoursToSub: number): string

Returns the date/time by subtracting the specified number of hours from the provided date/time.

DateUtcSubMinutes(date: string, minutesToSub: number): string

Returns the date/time by subtracting the specified number of minutes from the provided date/time.

DateUtcSubSeconds(date: string, secondsToSub: number): string

Returns the date/time by subtracting the specified number of seconds from the provided date/time.

DateDifference(date1: string or number, date2: string or number, duration: string): number

Returns the difference between the two dates or numbers based on the duration value, where the duration can be any of the following: seconds, minutes, hours, days, weeks, months, or years.

DateGetTime(): number

Returns the current UTC in milliseconds.

DateUtc(): string

Returns the current UTC formatted as a string.

DateIso(date: string, number or Date): string

Returns the provided date value formatted as a string in ISO format.