Heim  >  Artikel  >  Datenbank  >  深入mysql YEAR() MONTH() DAYOFMONTH()日期函数的详解_MySQL

深入mysql YEAR() MONTH() DAYOFMONTH()日期函数的详解_MySQL

WBOY
WBOYOriginal
2016-06-01 13:25:011769Durchsuche

bitsCN.com

mysql的日期函数. 例子中当前日期:
curdate() 是2013年6月24日。
YEAR() :显示年
mysql> select year(curdate()); +-----------------+ | year(curdate()) | +-----------------+ | 2013 | +-----------------+ 1 row in set (0.01 sec)
MONTH() :显示月
mysql> select month(curdate()); +------------------+ | month(curdate()) | +------------------+ | 6 | +------------------+ 1 row in set (0.00 sec)
DAYOFMONTH():显示日期
mysql> select dayofmonth(curdate()); +-----------------------+ | dayofmonth(curdate()) | +-----------------------+ | 24 | +-----------------------+ 1 row in set (0.08 sec)

bitsCN.com
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn