Dig into the mysql YEAR of MONTH of DAYOFMONTH of date function

  • 2020-05-24 06:21:29
  • OfStack

Date function of mysql. Current date in the example:
curdate() is June 24, 2013.
YEAR() : displays the year
mysql > select year(curdate()); +-----------------+ | year(curdate()) | +-----------------+ | 2013 | +-----------------+ 1 row in set (0.01 sec)
MONTH() : display month
mysql > select month(curdate()); +------------------+ | month(curdate()) | +------------------+ | 6 | +------------------+ 1 row in set (0.00 sec)
DAYOFMONTH() : displays the date
mysql > select dayofmonth(curdate()); +-----------------------+ | dayofmonth(curdate()) | +-----------------------+ | 24 | +-----------------------+ 1 row in set (0.08 sec)


Related articles: