I think date_trunc could work
examples (note the right padded zeroes and oh-ones)
Examples:
SELECT date_trunc(‘hour’, TIMESTAMP ‘2001-02-16 20:38:40’); Result: 2001-02-16 20:00:00
SELECT date_trunc(‘year’, TIMESTAMP ‘2001-02-16 20:38:40’); Result: 2001-01-01 00:00:00