mysql时间戳时间转换

获取当前时间戳

select unix_timestamp();

select unix_timestamp(now());

获取当前时间

select now();

时间转时间戳

select unix_timestamp('2019-01-15 09:45:16');

时间戳转时间

select from_unixtime(1573053179);

时间戳格式化

SELECT from_unixtime(1573053179, '%Y-%m-%d %H:%i:%S');

时间格式化

select date_format(now(), '%Y-%m-%d');
select date_format('2019-09-15 09:45:16', '%Y-%m-%d');

猜你喜欢

转载自www.cnblogs.com/lemonzwt/p/11809411.html