Time in ruby

why ruby does not have 15.minutes method? rails seem does

because rails defines it

is there any way to get Time.now-15.minutes with ruby?

Time.now-15*60

=> Thu May 31 09:52:34 -0700 2012

minus the number of seconds

 

>> a=Time.now
=> Mon Jun 11 19:40:57 -0700 2012
>> a-15*60 (seconds)
=> Mon Jun 11 19:25:57 -0700 2012
>> a=DateTime.now
=> Mon, 11 Jun 2012 19:41:09 -0700
>> a-15*60 (days)
=> Thu, 24 Dec 2009 19:41:09 -0700

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s