scalar-extension
date_bin
Align timestamps to fixed-width bins relative to an origin. Stride must be positive and cannot include months or larger units.
Formal Syntax & Structure
sql syntaxsql
date_bin(stride interval, source timestamp, origin timestamp)Working Example
Example Snippetsql
SELECT date_bin('15 minutes', timestamp '2025-01-01 10:17:00', timestamp '2025-01-01 00:00:00');