Date Time format in Ruby

Can anyone give a suggestion so that i can able to format the date as
like this 3th - 5th June 2009
--

require 'date'

=> []

Date::MONTHNAMES

=> [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

myformat = lambda {|date| "%s %s %d"%[date.mday.ordinalize,

Date::MONTHNAMES[date.month], date.year] }
=> #<Proc:0x00007ff7862efcb8@(irb):7>

myformat[Date.today]

=> "21st April 2009"

That ought to be enough of a suggestion! Note that this is inside a Rails console so if you did this in plain Ruby, you'd have to require 'rubygems' and require 'activesupport' to get Fixnum#ordinalize

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com