How to Round Timestamps in PostgreSQL

Rounding/truncating timestamps are especially useful when you're grouping by time. The function you need here is date_trunc:

select date_trunc('second', now()) -- or minute, hour, day, month
database icon
From PostgreSQL query to chart to Slack in seconds
Get to answers faster, together, with PopSQL and PostgreSQL