TO_SECONDS

2024-04-19 08:42:50  Updated

Syntax

TO_SECONDS(expr)

Purpose

TO_SECONDS() returns the number of seconds from the year 0 to the date or datetime expression expr. If expr is NULL, NULL is returned.

Examples

obclient> SELECT TO_SECONDS(950501);
+--------------------+
| TO_SECONDS(950501) |
+--------------------+
|        62966505600 |
+--------------------+
1 row in set

obclient> SELECT TO_SECONDS('2021-07-15');
+--------------------------+
| TO_SECONDS('2021-07-15') |
+--------------------------+
|              63793526400 |
+--------------------------+
1 row in set

Contact Us