MySQL时间戳和时间的获取/相互转换/格式化

时间:5年前   阅读:3241

获取当前时间戳

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 

本站声明:网站内容来源于网络,如有侵权,请联系我们https://www.qiquanji.com,我们将及时处理。

微信扫码关注

更新实时通知

上一篇:沪深300ETF期权适合做短线吗?

下一篇:散户能开通上证50etf期权吗?

网友评论

请先 登录 再评论,若不是会员请先 注册