Skip to main content

Date and Time functions

Function List:

Date(year, month, day)

Returns a date composed of the specified year, month and day.

Date(2002, 3, 15)

DateAdd(dt, ts)

Returns the date dt with the time span ts appended to it.

DateAdd(${StartDate}, ${Duration})

DateDiff(dt1, dt2)

Returns the difference (time span) between two dates dt1 and dt2.

DateDiff(${FirstDate}, ${SecondDate})

DateNow()

Returns the current date.

DateAdd(DateNow(), ${Duration})

DateParse(s)

Constructs and returns a date based on string pattern s.

DateParse("20120227T132700")    // 2012-02-27 13:27:00.000

DateTime(year, month, day, hours, minutes, seconds, milliseconds)

Returns a date composed of the specified parameters.

DateTime(2002, 3, 15, 23, 59, 45, 999)

DayOfMonth(dt)

Returns the day of the month for the date dt.

DayOfMonth(Date(2021, 6, 14))    // 14

DayOfWeek(dt)

Returns the day of the week for the date dt. The days of the week are numbered from 1 to 7.

DayOfWeek(Date(2020, 12, 31))    // 4

DayOfYear(dt)

Returns the day of the year for the date dt.

DayOfYear(Date(2021, 2, 25))    // 56 (31 + 25)

Hour(dt)

Returns the hour of the date dt.

Hour(DateTime(2002, 3, 15, 23, 59, 45, 999))    // 23

Millisecond(dt)

Returns the millisecond of the date dt.

Millisecond(DateTime(2002, 3, 15, 23, 59, 45, 999))    // 999

Minute(dt)

Returns the minute of the date dt.

Minute(DateTime(2002, 3, 15, 23, 59, 45, 999))    // 59

Month(dt)

Returns the month of the date dt.

Month(DateTime(2002, 3, 15, 23, 59, 45, 999))    // 3

Quarter(dt)

Returns the quarter of the date dt.

Quarter(Date(2002, 3, 15))    // 1

Second(dt)

Returns the second of the date dt.

Second(DateTime(2002, 3, 15, 23, 59, 45, 999))    // 45

Time(hours, minutes, seconds, milliseconds)

Returns a time composed of the specified parameters.

The time is actually a DateTime with a special insignificant date 0001-01-01.

Time(23, 59, 45, 999)    // 0001-01-01 23:59:45.999

TimeParse(s)

Constructs and returns a time based on string pattern s.

The time is actually a DateTime with a special insignificant date 0001-01-01.

TimeParse("13:27")    // 0001-01-01 13:27:00.000

Today()

Returns today's date.

Today()    // On January 1, 2021, would return the value 01-01-2021 00:00:00.000

Weeknum(dt)

Returns the week number of the date dt.

Weeknum(Date(2021, 2, 3))    // 5

Year(dt)

Returns the year of the date dt.

Year(Date(2021, 2, 3))    // 2021
  • Date(year, month, day)
  • DateAdd(dt, ts)
  • DateDiff(dt1, dt2)
  • DateNow()
  • DateParse(s)
  • DateTime(year, month, day, hours, minutes, seconds, milliseconds)
  • DayOfMonth(dt)
  • DayOfWeek(dt)
  • DayOfYear(dt)
  • Hour(dt)
  • Millisecond(dt)
  • Minute(dt)
  • Month(dt)
  • Quarter(dt)
  • Second(dt)
  • Time(hours, minutes, seconds, milliseconds)
  • TimeParse(s)
  • Today()
  • Weeknum(dt)
  • Year(dt)