Help with datetime

I need to do this:
If Time.now is:

=> Fri Mar 21 18:19:14 +0100 2008

I want to obatain 7 days more, like:

=> Fri Mar 28 18:19:14 +0100 2008

So I can then compare this two dates.

I need to do this:
If Time.now is:

=> Fri Mar 21 18:19:14 +0100 2008

I want to obatain 7 days more, like:

=> Fri Mar 28 18:19:14 +0100 2008

So I can then compare this two dates.

Time.now + 7.days
=> Fri Mar 28 10:24:29 -0700 2008

7.days.from_now
=> Fri Mar 28 10:24:36 -0700 2008

On Mar 21, 2008, at 1:21 PM, John S. wrote:

I need to do this:
If Time.now is:

=> Fri Mar 21 18:19:14 +0100 2008

I want to obatain 7 days more, like:

7.days.from_now

=> Fri Mar 28 18:19:14 +0100 2008

So I can then compare this two dates.

or:

today = Time.now
7.days.since(today)
today + 7.days

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs