If you use Rails or don't mind including ActiveSupport, you can use numeric # days DSL as follows:
ruby-1.9.2-p136 :002 > Date.today => Wed, 02 Mar 2011 ruby-1.9.2-p136 :003 > Date.today - 90.days => Thu, 02 Dec 2010
Since you work with dates, not just once, you should also start with Date instances or convert your DateTime dates to C # to_date. When adding / subtracting numbers from instances of the date, the numbers are implicitly days.
ruby-1.9.2-p136 :016 > DateTime.now.to_date => #<Date: 2011-03-02 (4911245/2,0,2299161)> ruby-1.9.2-p136 :017 > DateTime.now.to_date - 90 => #<Date: 2010-12-02 (4911065/2,0,2299161)>
Gabe Martin-Dempesy Mar 02 '11 at 18:07 2011-03-02 18:07
source share