create table testDate(
id int primary key auto_increment,
datetime date
);
insert into testDate values (1,str_to_date('2007-12-20',' %Y-%m-%d'));
涉及函数:
1.date_format(日期,格式): 日期转换字符串
2.str_to_date(字符串,格式): 字符串转换日期
其中日期格式为: %Y%m%d %H:%i:%s
%W 星期名字 英文单词
%Y
年 四位年
%y
年 两位年
%a
星期缩写
%m
月
%d
天
%H
时
%i
分
%s
秒