Home »
MySQL »
MySQL date/time Functions
MySQL MONTHNAME() Function
MySQL | MONTHNAME() Function: Learn about the MONTHNAME() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 10, 2022
MONTHNAME() Function
The MONTHNAME() function helps us to get the complete month name from any datetime value. It fetches the month name from the date and then displays it as a result.
MONTHNAME() Syntax
SELECT MONTHNAME('datetime value');
MONTHNAME() Parameter(s)
- It takes only one parameter which is datetime value.
MONTHNAME() Return Value
As a result, it will display the name of the month from the given date/time that you have provided.
MySQL MONTHNAME() Function Example 1
SELECT MONTHNAME('2012-09-08');
MySQL MONTHNAME() Function Example 2
SELECT MONTHNAME('2022-04-09 12:09:08');
But if you will provide the date which is not valid then in such case it will show you NULL.
MySQL MONTHNAME() Function Example 3
SELECT MONTHNAME('2022-44-09');
In the above example, we can see that the month has 44 value which is not valid therefore it displays NULL.