//查看当前时间
SELECT now();
//查看当前时间戳
SELECT UNIX_TIMESTAMP(now());
//时间戳转时间
SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(now()));
结果:
2019-01-07 09:44:31
1546854271(说明mysql时间戳timestamp类型默认单位是秒,不是毫秒)
2019-01-07 09:44:31
//查看当前时间
SELECT now();
//查看当前时间戳
SELECT UNIX_TIMESTAMP(now());
//时间戳转时间
SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(now()));
结果:
2019-01-07 09:44:31
1546854271(说明mysql时间戳timestamp类型默认单位是秒,不是毫秒)
2019-01-07 09:44:31