Date_trunc doesn't work

I reported an issue last year in which I wasn’t able to subtract time from a date using date_trunc(‘day’,…). I was able to work around it by using this syntax:
cast(cast(cast(column as date) as timestamp) as date)

But now I need to truncate a timestamp to hours, and so my cast(cast(cast…))) syntax does not work.

This is what I’m attempting to use:
to_char( date_trunc('hour',column),'yyyy-mm-dd hh24:mi:ss')

but it has no effect – the full timestamp, including minutes and seconds, is displayed.

How do I truncate a timestamp to hours?

Hello Joe,

Instead of date_trunc(‘hour’, column)

can you try

date_trunc_hour(column)

and let us know whether you able to get the expected.

Thanks,
Rakesh