DATE_TRUNC

The DATE_TRUNC function truncates a timestamp expression or literal based on the date part that you specify. DATE_TRUNC returns the first day of the specified year, the first day of the specified month, or the Monday of the specified week.

Syntax

DATE_TRUNC('datepart', timestamp)

Example

SELECT DATE_TRUNC('HOUR', TIMESTAMP '2020-01-14 13:22:35') AS HOUR;

The above query returns:

2020-01-14 13:00:00