Date Time Functions MySQL Tutorial

Extraction functions extract specific information about a date (year, month, day etc).
These include:
FunctionDisplaysExample
DAYOFMONTH(date)The numeric day of the month01, 10, 17, 24 etc
DAYNAME(date)The Name of the dayMonday, Wednesday, Friday etc
MONTH(date)The numeric month01, 04, 08, 11 etc
MONTHNAME(date)The Month nameJanuary, April, August etc
YEAR(date)Four digit year1998, 2000, 2002, 2003 etc
HOUR(time)Hour (24 hour clock)07, 11, 16, 23 etc
MINUTE(time)Minutes01, 16, 36, 49 etc
SECOND(time)Seconds01, 16, 36, 49 etc
DAYOFYEAR(date)Numeric day of the year1, 366

mysql>
mysql> SELECT DAYNAME('1989-07-20');
+-----------------------+
| DAYNAME('1989-07-20') |
+-----------------------+
| Thursday              |
+-----------------------+
1 row in set (0.00 sec)
mysql>