necker necker - 1 year ago 66
Ruby Question

how do I get name of the month in ruby on Rails?

so i create in my view:


How do i get the name of the month out of the date? I was trying to do sth like

<%= DATE::ABBR_MONTHNAMES(date.month)%>

But without success. I keep getting an error: uninitialized constant

How do i initialise the constant or is there any other way to get the name out of the Date format?

would greatly appreciate any answers!

Answer Source

Ref this

<% @date =  %>  
<%= @date.strftime("%B")%>


@date >> Fri, 11 Jun 2010


@date.strftime("%B") >> "June"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download