Reputation: 33
I'm trying to get the name of the Month through Monthname, but it just returns (NULL)
Date = 4
MONTHNAME(str_to_date(Month(Date), '%m'))
Upvotes: 2
Views: 521
Reputation: 236
Try this:
SELECT MONTHNAME(STR_TO_DATE(1, '%m'));//returns January
Also read this Documentation
Upvotes: 1
Reputation: 30819
As per MySQL's documentation, you can use MONTHNAME
function directly on date
column, e.g.:
SELECT MONTHNAME(Date);
This would give you the required result.
Upvotes: 2