DATE_TRUNC
Truncates the date or timestamp to the indicated precision.
Syntax
DATE_TRUNC(time_unit LITERAL, date_timestamp_expression DATE OR TIMESTAMP) → DATE
time_unit: The time unit that the date or timestamp needs to be truncated at. This must be the literal value of ‘YEAR’, ‘MONTH’, ‘DAY’, ‘HOUR’, ‘MINUTE’, or ‘SECOND’.
date_timestamp_expression: The date or timestamp to truncate. This value must be a literal in the date or timestamp format.
Examples
DATE_TRUNC example
DATE_TRUNC example
DATE_TRUNC example
Last updated