The ruby way : DateTime calculations ?

P

Peter Fitzgibbons

------=_Part_40247_27866611.1132613307023
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Is there an existent lib or such that gives me some date/time calculations =
?

Time.now - 2.minutes for instance ?

Thanks,
 
K

Kirk Haines

Is there an existent lib or such that gives me some date/time calculations
?

Time.now - 2.minutes for instance ?

Time.now - 2 * 60

or

(some people would argue that this is the best approach)

Minute = 60
Hour = Minute * 60
Day = Hour * 24
Time.now - 2 * Minute

or

The ActiveSupport library for Rails has those sorts of methods defined.

or

I think Facets might have these, too.

or

Roll your own. They are easy to write.


Kirk Haines
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,185
Latest member
GluceaReviews

Latest Threads

Top