http://rails.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Calculations.html#M001139 documents a method advance()
to add to the current time. Is there an opposite, 'go_back()
method?
views:
450answers:
3
+6
A:
I don't think there is but there's nothing to stop you using negative values in advance
.
Time.now.advance(:days => - 1, :hours => -1)
Eifion
2009-08-17 20:58:51
trying this out now...thanks
2009-08-17 21:02:15
ok this works. awesome.
2009-08-17 21:12:00
A:
You could also try using
Time.now.ago(3.days)
Time.now.ago(3.days+3.hours)
Yaraher
2009-08-18 13:50:27