DATE_TRUNC truncates a date to a specified precision. The idea is similar to the trunc function for numbers.
The syntax is: date_trunc(text, source)
Valid values for text are:
In this example, ‘source’ is a TIMESTAMP value with microsecond precision:
date_trunc('hour', timestamp '2011-02-26 10:35:44:712005')
Returns: 2011-02-26 10:00:00