Mega Code Archive

 
Categories / MySQL / Date Time
 

Extract only the month by using the MONTH() function

mysql> mysql> mysql> SELECT MONTH('2004-12-31 23:59:59'); +------------------------------+ | MONTH('2004-12-31 23:59:59') | +------------------------------+ |                           12 | +------------------------------+ 1 row in set (0.00 sec)