MySQL: MONTHNAME Function
This MySQL tutorial explains how to use the MySQL MONTHNAME function with syntax and examples.
Description
The MySQL MONTHNAME function returns the full name of the month for a date.
Syntax
The syntax for the MONTHNAME function in MySQL is:
MONTHNAME( date_value )
Parameters or Arguments
- date_value
- A date or datetime value from which to extract the full month name.
Note
- The MONTHNAME function returns the full name of the month (January, February, ... December) given a date value.
Applies To
The MONTHNAME function can be used in the following versions of MySQL:
- MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23
Example
Let's look at some MySQL MONTHNAME function examples and explore how to use the MONTHNAME function in MySQL.
For example:
mysql> SELECT MONTHNAME('2014-01-27'); Result: 'January' mysql> SELECT MONTHNAME('2014-05-08'); Result: 'May' mysql> SELECT MONTHNAME('2014-12-29'); Result: 'December'
This last MONTHNAME example would display the month name for the current system date (current system date is returned by the CURDATE function).
mysql> SELECT MONTHNAME(CURDATE());
Advertisements