您可以借助current_timestampnow()
和current_timestamp()获得时间戳。
查询如下-
mysql> SELECT CURRENT_TIMESTAMP();
以下是显示时间戳的输出-
+---------------------+ | CURRENT_TIMESTAMP() | +---------------------+ | 2018-11-29 16:09:31 | +---------------------+ 1 row in set (0.00 sec)
now()
查询如下-
mysql> select now();
以下是输出-
+---------------------+ | now() | +---------------------+ | 2018-11-29 16:09:38 | +---------------------+ 1 row in set (0.00 sec)
您可以在以下查询的帮助下获取整数UNIX时间戳-
mysql> select unix_timestamp();
以下是输出-
+------------------+ | unix_timestamp() | +------------------+ | 1543488374 | +------------------+ 1 row in set (0.04 sec