Date

The Date function converts a text or number value to the date data type in ISO date time format.

The text or number value must already reflect ISO or Unix time format to convert properly. When an input value doesn't reflect ISO or Unix time formats, use the DateParse function.

Syntax

Date(value)

Function arguments:

value(required) The value or column containing values to convert to date data values in ISO date time format.
Input values must reflect ISO date time format (yyyy-mm-dd or yyyy-mm-dd hh:mm:ss)

Notes

  • When value is an a number, the value is interpreted as a Unix timestamp, and behaves like the DateFromUnix function, returning the date time value in ISO format for the number of non-leap seconds that have passed since 00:00:00 UTC on January 1, 1970.
  • When value is a text value, the function interprets it as an ISO date time value. At a minimum, the text value must include a four-digit year, two-digit month, and two-digit day, separated by dashes (yyyy-mm-dd).
  • If value is Null, the function returns Null.

Examples

Greatest([Invoice Date], Date(“2018-01-01”))

The Date function interpets the text 2018-01-01 as a date value representing January 1, 2018. The Greatest function then evaluates date values in the Invoice Date column against January 1, 2018 and returns the most recent of the two dates in ISO date time format.

Date(1503724894)

Interprets the Unix timestamp as 1,503,724,894 seconds past 00:00:00 UTC on January 1, 1970 and returns the ISO date time value 2017-08-26 05:21:34.

Date("2017-08-26 05:21:34")

Returns the ISO date time value 2017-08-26 05:21:34.

IsNull(Date(Null))

Returns True.