Rails date formats

Handy:

In console:

Date::DATE_FORMATS.each_pair {|key, value|puts "#{key} => #{Date.today.to_s(key)}"}

Prints a list of each available format with an example.

short => 15 May
long => May 15, 2008
long_ordinal => May 15th, 2008
db => 2008-05-15
rfc822 => 15 May 2008
number => 20080515

Would be better as a rake task.

Leave a Reply