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...
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)2019-11-02
mengvlog 阅读 8 次 更新于 2025-06-20 00:57:37 我来答关注问题0
檬味博客在线解答立即免费咨询

mySQL相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部