DATE_BIN
Rounds a moment down to the start of an interval of any length: 15 minutes, 6 hours, 10 days.
Syntax
DATE_BIN(INTERVAL '<step>', <timestamp>, <origin>)
Like DATE_TRUNC, but the step can be anything, not just an hour or a day. The third argument is the origin the intervals are counted from: with it, DATE_BIN(INTERVAL '15 minutes', …) gives 15:30, 15:45, 16:00. Most often used to group events into 15-minute slots or shifts. Added in PostgreSQL 14.