;

How to Get the Month Name from a Date in MySQL


Tutorialsrack 26/01/2020 MySQL

In this article, we will learn how to get the month name from a date in MySQL.

In MySQL, MONTHNAME() function returns the full name of the month for a specified date. 

MONTHNAME() function returns a value from January to December as an output.

Here are some examples of the MONTHNAME() Function in MySQL.

Various Examples of MONTHNAME() Function
SELECT MONTHNAME(now()) AS 'Month Name';
-- This will return Month Name as -> Current MonthName whatever it is

SELECT MONTHNAME('2020-08-01') AS 'Month Name';
-- This will return Month Name as -> August

SELECT MONTHNAME('2020-00-00') AS 'Month Name';
-- This will return Month Name as -> NULL

SELECT MONTHNAME('2020/1/1') AS 'Month Name';
-- This will return Month Name as -> January

SELECT MONTHNAME('2020-01-02 12:20:30') AS 'Month Name';
-- This will return Month Name as -> January

SELECT MONTHNAME('2020-01-02 0:0:1') AS 'Month Name';
-- This will return Month Name as -> January

I hope this article will help you to understand how to get the month name from a date in MySQL.

Share your valuable feedback, please post your comment at the bottom of this article. Thank you!


Related Posts



Comments

Recent Posts
Tags