Home >Database >Mysql Tutorial >MySQL中DATA_FORMAT函数的用法_MySQL

MySQL中DATA_FORMAT函数的用法_MySQL

WBOY
WBOYOriginal
2016-06-01 13:37:231740browse

bitsCN.com

MySQL中DATA_FORMAT函数的用法

 

一、API例子

DATE_FORMAT(NOW(),'%b %d %Y %h:%i %p')

DATE_FORMAT(NOW(),'%m-%d-%Y')

DATE_FORMAT(NOW(),'%d %b %y')

DATE_FORMAT(NOW(),'%d %b %Y %T:%f')

Dec 29 2008 11:45 PM

12-29-2008

29 Dec 08

29 Dec 2008 16:25:46.635

 

二、现实中的例子

 

select DATE_FORMAT(SYSDATE(),'%Y-%m-%e %H:%i:%S')

2012-12-28 09:50:21

select DATE_FORMAT('2012-01-01','%Y-%m-%e %H:%i:%S')

2012-01-1 00:00:00

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn