Alex Rivera | Logout

Opposite of Time.now.advance() in Ruby

Asked 2009-08-17T20:49:39.613
11

http://api.rubyonrails.org/classes/Time.html#method-i-advance documents a method advance() to add to the current time. Is there an opposite, 'go_back() method?

Edit
Report

2 Answers

8

You could also try using

Time.now.ago(3.days)
Time.now.ago(3.days+3.hours)
answered 2009-08-18T13:50:27.410
2

You can use something like the following example

Time.now - 3.days
answered 2009-08-17T21:06:22.543

Your Answer