ActiveSupport、Date#to_formatted_s, #to_s

>> require "rubygems"
=> true
>> require "active_support"
=> true
>> Date.new(2008,12,31).to_formatted_s
=> "2008-12-31"
>> Date.new(2008,12,31).to_formatted_s(:db)
=> "2008-12-31"
>> Date.new(2008,12,31).to_formatted_s(:short)
=> "31 Dec"
>> Date.new(2008,12,31).to_formatted_s(:long)
=> "December 31, 2008"
>> Date.new(2008,12,31).to_formatted_s(:long_ordinal)
=> "December 31st, 2008"
>> Date.new(2008,12,31).to_formatted_s(:rfc822)
=> "31 Dec 2008"
>> Date.new(2008,12,31).to_s(:rfc822)
=> "31 Dec 2008"
>> Date.new(2008,12,31).to_s(:month_and_year)
=> "2008-12-31"
>> Date::DATE_FORMATS[:month_and_year] = "%B %Y"
=> "%B %Y"
>> Date.new(2008,12,31).to_s(:month_and_year)
=> "December 2008"
>> Date.new(2008,12,31).to_s(:short_ordinal)
=> "2008-12-31"
>> Date::DATE_FORMATS[:short_ordinal] = lambda { |date| date.strftime("%B #{date.day.ordinalize}") }
=> #<Proc:0xb7888f30@(irb):20>
>> Date.new(2008,12,31).to_s(:short_ordinal) => "December 31st"