1.UNIX时间戳转换为日期 FROM_UNIXTIME()
SELECT FROM_UNIXTIME(1515402934) FROM DUAL;
2.日期转换为UNIX时间戳 UNIX_TIMESTAMP()
SELECT UNIX_TIMESTAMP(NOW()) FROM DUAL;
3.DATE_FORMAT转想要的日期
SELECT DATE_FORMAT(NOW(), '%Y-%m-%d') FROM DUAL;
SELECT FROM_UNIXTIME(1515402934) FROM DUAL;
SELECT UNIX_TIMESTAMP(NOW()) FROM DUAL;
SELECT DATE_FORMAT(NOW(), '%Y-%m-%d') FROM DUAL;
本文标题:MySQL日期常用函数
本文链接:https://www.haomeiwen.com/subject/qgibnxtx.html
网友评论