Forum: Ruby on Rails Convert Number (1-12) into Month (Word)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
744b6438d1457d332d1a8d431cc2b641?d=identicon&s=25 (Guest)
on 2007-03-30 05:04
(Received via mailing list)
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?

Ef0db53920b243d6758c2f6b1306df0d?d=identicon&s=25 Steve Ross (cwd)
on 2007-03-30 05:08
(Received via mailing list)

Date::MONTHNAMES wrote:
> Is there a function for this, or am I on my own?
> Thanks!
> >

View this message in context:
Sent from the RubyOnRails Users mailing list archive at
888e0536d537efdd327f3a1c39335e4c?d=identicon&s=25 Christos Zisopoulos (Guest)
on 2007-03-30 15:41
(Received via mailing list)
>> month = 1
>> Date::MONTHNAMES[month]
=> 'January'


On Mar 30, 5:03 am, ""
This topic is locked and can not be replied to.