【MySQL】日期格式化
1、时间格式化成固定格式字符串
SELECT DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s')
2、获取时间戳
select UNIX_TIMESTAMP("2022-07-06 14:11:49") select UNIX_TIMESTAMP(NOW()) select UNIX_TIMESTAMP()
3、时间戳格式化字符串
SELECT FROM_UNIXTIME(1657183074,'%Y-%m-%d %H:%i:%s')
-----------------------------------------------------------------Take more responsibility!---------------------------------------------------------