0°

如何在mysql里格式化日期

下面的代码:

date_format(date,’%Y-%m-%d’);

将把时间格式化为日期形式的字符串—(2010-09-23)

各种示例:

Example Date: 1st April 2005
Replace date with the name of your date field…
date_format StringExample
‘%e/%c/%Y’1/4/2005 UK
‘%c/%e/%Y’4/1/2005 US
‘%d/%m/%Y’01/04/2005 UK
‘%m/%d/%Y’04/01/2005 US
‘%e/%c/%Y %H:%i’1/4/2005 12:30 UK
‘%c/%e/%Y %H:%i’4/1/2005 12:30 US
‘%d/%m/%Y %H:%i’01/04/2005 12:30 UK
‘%m/%d/%Y %H:%i’04/01/2005 12:30 US
‘%e/%c/%Y %T’1/4/2005 12:30:10 UK
‘%c/%e/%Y %T’4/1/2005 12:30:10 US
‘%d/%m/%Y %T’01/04/2005 12:30:10 UK
‘%m/%d/%Y %T’04/01/2005 12:30:10 US
‘%a %D %b %Y’Fri 1st Apr 2005
‘%a %D %b %Y %H:%i’Fri 1st Apr 2005 12:30
‘%a %D %b %Y %T’Fri 1st Apr 2005 12:30:10
‘%a %b %e %Y’Fri Apr 1 2005
‘%a %b %e %Y %H:%i’Fri Apr 1 2005 12:30
‘%a %b %e %Y %T’Fri Apr 1 2005 12:30:10
‘%W %D %M %Y’Friday 1st April 2005
‘%W %D %M %Y %H:%i’Friday 1st April 2005 12:30
‘%W %D %M %Y %T’Friday 1st April 2005 12:30:10
「点点赞赏,手留余香」

    还没有人赞赏,快来当第一个赞赏的人吧!
0 条回复 A 作者 M 管理员
    所有的伟大,都源于一个勇敢的开始!
欢迎您,新朋友,感谢参与互动!欢迎您 {{author}},您在本站有{{commentsCount}}条评论