Syntax
UNIX_TIMESTAMP()
UNIX_TIMESTAMP(date)
Purpose
If the
dateargument is not specified,UNIX_TIMESTAMP()returns the number of seconds from'1970-01-01 00:00:00'to the current time, taking into account the time zone.If the
dateargument is specified, this function returns the number of seconds from'1970-01-01 00:00:00'to the specified time, taking into account the time zone.
Examples
obclient> SELECT UNIX_TIMESTAMP(), TIME_TO_USEC(NOW());
+------------------+---------------------+
| UNIX_TIMESTAMP() | TIME_TO_USEC(NOW()) |
+------------------+---------------------+
| 1525570561 | 1525570561000000 |
+------------------+---------------------+
1 row in set
obclient> SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00');
+---------------------------------------+
| UNIX_TIMESTAMP('1997-10-04 22:23:00') |
+---------------------------------------+
| 875974980 |
+---------------------------------------+
1 row in set