The Date function converts text and number values to the date data type, with ISO date time format. Date data types appear in Sigma UI with a date format icon, Date data type icon.

Text and number values must already reflect ISO format to correctly convert the output. For values in non-ISO formats, use the DateParse function.

Use the Date function inside other functions to ensure that a value is read as a date datatype, not as a string/text.

Syntax

Date(value)

This function has the following argument:

value
Required
The column that contains values to convert the Date datatype with ISO date time format.
When converting from text, input values must be in the format "yyyy-mm-dd" or "yyyy-mm-dd hh:mm:ss". Remember to use double quotes in text to date conversions.
When converting from integers that represent epochs, the Date function behaves like DateFromUnix. It interprets the integer as the UNIX timestamp or the number of seconds after midnight of January 1 1970 in UTC time (Greenwich mean time without daylight savings time adjustments).
Use numerical input to perform arithmetic operations in the function, such as adding, subtracting, multiplying, and dividing. 

Examples

Date(1503724894)

Returns 2017-08-26 05:21:34; note this is the evaluation of January 1 1970 plus 1,503,724,894 seconds.

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

Evaluates all values in the Invoice Date column (of date data type) against January 1, 2018 and returns the most recent of the two dates. In this example, using the Date function to wrap the "2018-01-01" value ensures that the Greatest function uses a date data type for both inputs.

Related functions


Was this page helpful?
Yes No