跳到主要内容

TIMESLOT

Rounds the time to the half hour.

Syntax

TIMESLOT( <expr> )

Arguments

ArgumentsDescription
<expr>datetime

Return Type

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

Examples

SELECT timeslot(now());
+---------------------+
| timeslot(now()) |
+---------------------+
| 2022-03-29 06:30:00 |
+---------------------+

SELECT timeslot(to_datetime(1630812366));
+----------------------------------+
| timeslot(to_datetime(1630812366)) |
+----------------------------------+
| 2021-09-05 03:00:00 |
+----------------------------------+