mysql 中怎么把字符串转换成date

如题所述

日期转字符串
mysql>
select
date_format(now(),'%y');
+-------------------------+
|
date_format(now(),'%y')
|
+-------------------------+
|
2009
|
+-------------------------+
1
row
in
set
(0.00
sec)
扩展:
%y:年
%c:月
%d:日
%h:小时
%i:分钟
%s:秒
mysql>
select
date_format(now(),'%y-%c-%d
%h:%i:%s');
+----------------------------------------+
|
date_format(now(),'%y-%c-%d
%h:%i:%s')
|
+----------------------------------------+
|
2009-8-07
06:59:40
|
+----------------------------------------+
1
row
in
set
(0.00
sec)
温馨提示:答案为网友推荐,仅供参考
相似回答