/*
* FROM_UNIXTIME(unix_timestamp)是MySQL里的时间函数。
* UNIX_TIMESTAMP() 是与之相对正好相反的时间函数 。
*/
select unix_timestamp('2017-01-01',);
-- 输出:1,483,200,000
select from_unixtime(1483200000);
-- 输出:2017-01-01 00:00:00.0
select from_unixtime(1483200000,'%Y-%m-%d %H:%i:%S' );
-- 输出:2017-01-01 00:00:00
select FROM_UNIXTIME(1344954515,'%Y-%m-%d %H:%i:%S');
-- 输出:2012-08-14 22:28:35
两个SQL时间戳函数介绍
最新推荐文章于 2023-08-26 23:55:55 发布