temporal-trunc
Truncates a timestamp value to the specified precision. For example, truncating a timestamp down to the hour returns the timestamp corresponding to start of the hour of the original timestamp’s hour.
Syntax
Section titled “Syntax”trunc( <timestamp_expr>, <unit> )
Arguments
Section titled “Arguments”<timestamp_expr>
Section titled “<timestamp_expr>”This argument must evaluate to a timestamp.
<unit>
(named)
Section titled “<unit> (named)”This argument must be one of the strings listed below:
hour
minute
second
millisecond
microsecond
nanosecond
Returns
Section titled “Returns”The returned value is of timestamp type.
Examples
Section titled “Examples”Truncate a timestamp down to the minute:
SELECT now(), trunc(now(), 'minute');
+-----------------------------+------------------------+| now() | trunc(now(), 'minute') |+-----------------------------+------------------------+| 2025-01-24T08:13:39.192704Z | 2025-01-24T08:13:00Z |+-----------------------------+------------------------+