跳转到主要内容

TO_SECOND

Converts a date with time (timestamp/datetime) to a UInt8 number containing the number of the second in the minute (0-59).

Syntax

to_second( <expr> )

Arguments

ArgumentsDescription
<expr>timestamp

Return Type

UInt8 datatype.

Examples

SELECT to_second(now());
+-----------------+
| to_second(now()) |
+-----------------+
| 14 |
+-----------------+

SELECT to_second(to_timestamp(1630812366));
+-------------------------------------+
| to_second(to_timestamp(1630812366)) |
+-------------------------------------+
| 6 |
+-------------------------------------+