From: Jonathan Leighton Date: 2006-01-18T02:02:06+09:00 Subject: Re: Time Diff Module On Wed, 2006-01-18 at 01:48 +0900, David Clements wrote: > Anyone know of a module out there that will encapsulate differences in time? > > Ideally I would want something like this: > > d1 = DateTime.now + 2.hours + 2.minutes > d2 = DateTime.now > > diff = d1-d2 > > > puts "Diff: #{diff.hours}:#{diff.minutes}" > > > >> Diff: 2:02 > > I have searched for examples and all of them seem to be doing this manually. > > Dave Ruby on Rails' ActiveSupport::CoreExtensions::Numeric::Time module supports this. The gem is activesupport. You might want to extract it somehow to avoid getting the rest of the library if you don't need it. Jon -- Jonathan Leighton http://turnipspatch.com/ | http://jonathanleighton.com/ | http://digital-proof.org/