This is a pretty silly question, but I haven't been able to find the answer. Does Ruby or Rails have a built in constant for the English month names i.e. January, February etc. or do I have to make my own?
Thanks,
John
This is a pretty silly question, but I haven't been able to find the answer. Does Ruby or Rails have a built in constant for the English month names i.e. January, February etc. or do I have to make my own?
Thanks,
John
Date does (Ruby class)
http://www.ruby-doc.org/stdlib/libdoc/date/rdoc/index.html
irb:
require 'date'
Date::MONTHNAMES
=> [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
Date::ABBR_MONTHNAMES
=> [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
Date::ABBR_MONTHNAMES[3]
=> "Mar"
michael_teter wrote:
Date does (Ruby class)
Excellent, that's just what I need. Thanks!