DATE_TRUNC function
Truncates a date or timestamp to the specified unit.
Syntax
DATE_TRUNC(unit, expression)
Arguments
unit: one of
YEAR,QUARTER,MONTH,WEEK,DAY,HOUR,MINUTE, orSECOND.expression: a
DATEorTIMESTAMP.
Returns
A TIMESTAMP.
Examples
> SELECT DATE_TRUNC('DAY', TIMESTAMP '2001-02-03 04:05:06');
2001-02-03 00:00:00