Extracts the year and month from the specified date
mysql>
mysql>
mysql> SELECT EXTRACT(YEAR_MONTH FROM '2004-12-31 23:59:59');
+------------------------------------------------+
| EXTRACT(YEAR_MONTH FROM '2004-12-31 23:59:59') |
+------------------------------------------------+
| 200412 |
+------------------------------------------------+
1 row in set (0.00 sec)
mysql>
Related examples in the same category