Skip to main content

timeslot

Rounds the time to the half hour.

Syntax

timeslot(expr)

Arguments

ArgumentsDescription
exprdatetime

Return Type

Datetime object, returns date in “YYYY-MM-DD hh:mm:ss” format.

Examples

mysql> select timeslot(now());
+---------------------+
| timeslot(now()) |
+---------------------+
| 2022-03-29 06:30:00 |
+---------------------+

mysql> select timeslot(toDateTime(1630812366));
+----------------------------------+
| timeslot(toDateTime(1630812366)) |
+----------------------------------+
| 2021-09-05 03:00:00 |
+----------------------------------+