From: "Jan E." Date: 2012-06-03T17:30:37+09:00 Subject: Re: Countdown dates in Ruby Hi, You can use the Date class from the standard library. It has all the necessary methods: - Date.parse to create a Date object from a string - date#<=>, so that Dates can be compared - date#downto to iterate over the timespan (in days) between two dates #------------------------------ require 'date' raw_dates = ['2012-06-03', '2011-12-22'] date_old, date_new = raw_dates.map{|str| Date.parse str}.sort date_new.downto date_old do |date| puts date.strftime '%d-%m-%Y' end #------------------------------ See http://ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html for the documentation. -- Posted via http://www.ruby-forum.com/.