Convert Number (1-12) into Month (Word)

Hi All,

Checked the API and archives, but can’t seem to find anything. Before
I roll my own I thought I would ask if this exists…

I have a field in the DB that stores a month as a number from 1 to
12. I would like to convert that for use in a view as the word for
the month. So 1 => January, 2=> February, and so on.

Is there a function for this, or am I on my own?

Thanks!

http://corelib.rubyonrails.org/classes/Date.html

Date::MONTHNAMES

[email protected] wrote:

Is there a function for this, or am I on my own?

Thanks!


View this message in context:
http://www.nabble.com/Convert-Number-(1-12)-into-Month-(Word)-tf3489990.html#a9746549
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

month = 1
Date::MONTHNAMES[month]
=> ‘January’

-christos

On Mar 30, 5:03 am, “[email protected]