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
Real-time SQL collaboration is here
Get started with PopSQL and PostgreSQL in minutes