Skip to main content

TIME_SLOT

Rounds the time to the half hour.

Syntax

time_slot(<expr>)

Arguments

ArgumentsDescription
<expr>timestamp

Return Type

TIMESTAMP, returns in “YYYY-MM-DD hh:mm:ss.ffffff” format.

Examples

SELECT time_slot(now());
+----------------------------+
| time_slot(now()) |
+----------------------------+
| 2022-10-15 02:30:00.000000 |
+----------------------------+

SELECT time_slot(to_timestamp(1630812366));
+-------------------------------------+
| time_slot(to_timestamp(1630812366)) |
+-------------------------------------+
| 2021-09-05 03:00:00.000000 |
+-------------------------------------+
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today