MySQL MONTH Clause – Get Month Name Instead of Number

javaMySQLmysql-5.5

My query is

SELECT MONTH(`hire_date`) AS month FROM `emp_tbl` 

I'm getting output in Java fx

if(resultSet.next()){
int month = resultset.getInt('month');           // output is like 11

}

Then I used swtich statement to get month in string. I want output like 'November' instead of 11. I dont want to use switch statment.
Is there is any other solution to get month name as a string instead of a number?

Any other solution besides SWITCH statement?

Best Answer

SELECT MONTHNAME('2018-11-03');

... should give 'November'. So use MONTHNAME instead of MONTH.

Another option is the DATE_FORMAT function. This should give the same result as above:

SELECT DATE_FORMAT('2018-11-03', '%M');

Use %b instead of %M to get abbreviated month names (Jan, Feb etc).