PDA

View Full Version : month (numeric) to string?? is there such?


eiji
March 14th, 2006, 06:05 AM
hi there :D

a little question..
im working on ruby on rails but the question is on ruby.. how do i output print out the month given that i have the numbers (1-12)

im using it in the select option (dropdown) where the month is outputted

<select name="member_account[birthday(2i)]">
<% month = 1
while month <= 12 %>
<option value="<%=month%>"><%=month%></option>
<% month += 1 %> #here it is uphere
<% end %> #how do i print it in its string format?
</select>

steve_d555
March 14th, 2006, 12:18 PM
There is actually a specific function just for selecting months. You can view it at the API (http://api.rubyonrails.com/classes/ActionView/Helpers/DateHelper.html#M000390).