获取当前时间戳
select unix_timestamp();
同:select unix_timestamp(now());
获取当前时间
select now();
时间转时间戳
select unix_timestamp('2018-01-15 09:45:16');
时间戳转时间
select from_unixtime(1515980716);
时间戳格式化
SELECT from_unixtime(1515980716, '%Y-%m-%d %H:%i:%S');
时间格式化
select date_format(now(), '%Y-%m-%d');
select date_format('2018-01-15 09:45:16', '%Y-%m-%d');
可视化转换
http://tool.chinaz.com/Tools/unixtime.aspx
---------------------
作者:lilongsy
来源:CSDN
原文:https://blog.csdn.net/lilongsy/article/details/79061639
版权声明:本文为博主原创文章,转载请附上博文链接!
MySQL时间戳和时间的获取/相互转换/格式化
最新推荐文章于 2022-09-07 14:33:04 发布