mysql中常常需要用到date、字符串、时间戳三者的转换,涉及的函数有
date_format(date,format) 日期格式化 例如 select date_format(now(), '%Y-%m-%d')
str_to_date(str,format) 字符转日期,这个常常会用到 select str_to_date('2018-04-10','%Y-%m-%d')
unix_timestamp() 参数可以是date,也可以是str
from_unixtime(112344784,'%Y-%d')
转载
https://www.cnblogs.com/jhy-ocean/p/5560857.html