MySQL
UNIX_TIMESTAMP(date) returns a UNIX timestamp of unsigned integer type (the number of seconds after '1970-01-01 00:00:00' GMT) if called without parameters, which is the inverse function of the FROM_UNIXTIME
() function.
If UNIX_TIMESTAMP() is called with date, it will return the parameter value as the number of seconds since '1970-01-01 00:00:00' GMT.
【Example】Use the UNIX_TIMESTAMP() function to return the timestamp in UNIX format, the input SQL statement and the execution result are as follows.
If UNIX_TIMESTAMP() is called with date, it will return the parameter value as the number of seconds since '1970-01-01 00:00:00' GMT.
【Example】Use the UNIX_TIMESTAMP() function to return the timestamp in UNIX format, the input SQL statement and the execution result are as follows.
mysql> SELECT UNIX_TIMESTAMP(),UNIX_TIMESTAMP(NOW()),NOW();
+------------------+-----------------------+---------------------+
| UNIX_TIMESTAMP() | UNIX_TIMESTAMP(NOW()) | NOW() |
+------------------+-----------------------+---------------------+
| 1551251270 | 1551251270 | 2019-02-27 15:07:50 |
+------------------+-----------------------+---------------------+
1 row in set (0.00 sec)