、date转时间戳、字符串转date、字符串转时间戳、时间戳转date,时间戳转字符串)用法,方便日后学习和查阅;
涉及的函数
date_format(date, format) 函数,MySQL日期格式化函数...date_format()
unix_timestamp() 函数
str_to_date(str, format) 函数
from_unixtime(unix_timestamp, format) 函数,MySQL...时间戳格式化函数from_unixtime
时间转字符串
select date_format(now(), '%Y-%m-%d');
#结果:2017-01-05
时间转时间戳
select...,'%Y-%d');
//结果:2017-01-05 20:45:24
附表
MySQL日期格式化(format)取值范围。...%j以三位数字表示年中天数(001,002, ...,366) 月%M 英文月名(January,February, ...,December) %b 英文缩写月名(Jan,Feb, ...