Skip to main content

TIME_BUCKET

Deprecated version

This document refers to a deprecated version of the RQL programming language.

Please go here for documentation related to the latest supported version.

Similar to DATE_TRUNC but the truncating period can be any interval.

Syntax
TIME_BUCKET(<interval>, <timestamp or date>)
Example
TIME_BUCKET(interval "100 milli", timestamp "2007-03-14 01:02:03.248") // "2007-03-14 01:02:02.200"
TIME_BUCKET(interval "2 years", timestamp "2007-03-14 01:02:03.004") // "2006-01-01 00:00:00"
info

To avoid approximation errors the truncating interval cannot have years or months mixed with days, weeks, hours, etc.