<expression>) of type DATE, TIMESTAMP, or TIMESTAMPTZ to the selected precision (<time_unit>).
Syntax
Parameters
Return Type
DATE if<expression> has type DATE, TIMESTAMP if <expression> has type TIMESTAMP, TIMESTAMPTZ if <expression> has type TIMESTAMPTZ.
Remarks
Truncation of TIMESTAMPTZ values is performed after conversion to local time in a particular time zone. For instance, truncation to ‘day’ produces a TIMESTAMPTZ that is midnight in that time zone. By default, the function uses the time zone specified in the session’stime_zone setting.
Alternatively, if the optional <time_zone> argument is provided, the function uses that time zone.
Firebolt raises an error if the optional <time_zone> argument is provided for an <expression> evaluating to DATE or TIMESTAMP.
Firebolt also raises an error if one attempts to truncate a value expression of type DATE to microsecond, millisecond, second, minute, or hour.
The DATE_TRUNC function can be used in the PARTITION BY clause of CREATE TABLE commands.
Example
The following examples truncateDATE and TIMESTAMP values without timezones.
Rows: 1Execution time: 5.54ms
Rows: 1Execution time: 5.62ms
TIMESTAMPTZ values.