This tutorial explains how to use the MySQL MONTH function with syntax and examples.
The MySQL MONTH function returns the month portion of a date value.
The syntax for the MONTH function in MySQL is:
MONTH( date_value )
A date or datetime value from which to extract the month.
The MONTH function can be used in the following versions of MySQL:
Let's look at some MySQL MONTH function examples and explore how to use the MONTH function in MySQL.
For example:
mysql> SELECT MONTH('2014-01-28');
Output: 1
mysql> SELECT MONTH('2014-01-28 15:21:05');
Output: 1
mysql> SELECT MONTH('2013-10-15');
Output: 10
This last MONTH example would display the month portion of the current system date (current system date is returned by the CURDATE function).
mysql> SELECT MONTH(CURDATE());