views:

450

answers:

3

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?

+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
trying this out now...thanks
ok this works. awesome.
A: 

You can use something like

Time.now - 3.days

for example

tliff
A: 

You could also try using

Time.now.ago(3.days)
Time.now.ago(3.days+3.hours)
Yaraher