Mysql常用命令
1.日期转时间戳
-- 转十位 select UNIX_TIMESTAMP('2018-12-25 12:25:00');
结果:1545711900
-- 转十三位 SELECT REPLACE(unix_timestamp(current_timestamp(3)),'.','');
结果:1545711900021
2.时间戳转日期:
FROM_UNIXTIME(unix_timestamp) --unix_timestamp为时间戳
-- 十位转 select FROM_UNIXTIME(1545711900);
结果:2018-12-25 12:25:00
3.当前时间
select current_timestamp();
本文来自博客园,作者:云敬轩,转载请注明原文链接:https://www.cnblogs.com/yjxuan/p/15502620.html