Results 1 to 3 of 3
Thread: Formatting dates in Ruby
Jun 6, 2006, 15:49 #1
Formatting dates in Ruby
I'm reading http://www.ruby-doc.org/core/classes/Date.html and trying to figure out how to get what I want out of a Date object.
I want to be able to take the date, give it a format string, and have it return a string with the date formatted properly.
Jun 6, 2006, 15:51 #2
Jun 6, 2006, 16:01 #3
Well the database column is type date, and so I believe Rails turns that into a Date object automatically.
I see a list of constants, like MONTHNAMES, at the link above... how do I access those? The Agile book shows a way to format dates using arrays like that, but I'd rather not re-create the arrays in my own code if they're already in the Date class.