Organizational Research By

Surprising Reserch Topic

mysql monthname from numbers

mysql monthname from numbers  using -'mysql'

Is there anyway to get the MONTHNAME() from just the number of the month (1-12)? For example if I have 6,7,8 is there any native way in MySQL to transform those into June,July,August?

asked Sep 24, 2015 by patilkiran.101
0 votes

Related Hot Questions

2 Answers

0 votes

You can use STR_TO_DATE() to convert the number to a date, and then back with MONTHNAME()


| June                            |

Warning: This could be slow if done over a lot of rows.

answered Sep 24, 2015 by deepak
0 votes

Before reading Michael's great answer I had thought something like this

select elt(3,'January','February','March',....)

but his one is much better. :)

answered Sep 24, 2015 by sameer rathore