queries:functions:timefloor

timefloor

The timefloor function rounds the time value to the closest interval value. This allows grouping based on time.

*WARNING*: The timefloor uses the interval parameter in order to do the calculation. This means the user can change the value.

Return Type Time
Aggregates No
Flags None

Parameters

Parameters: timefloor(time)

Name Type Description
time Time The time which will be rounded down to the closest interval.

Demonstration

The timefloor function is equivalent to floor(time_in_seconds / interval_in_seconds) * interval_in_seconds.

As all times in DuckProve are stored in seconds since 1970, a calculation with an interval of an hour could look like this:

timefloor(1438873349) = floor(1438873349 / 3600) * 3600 = 399687 * 3600 = 1438873200