From: "ABHILASH M.A" Date: 2011-03-10T01:03:00+09:00 Subject: Re: Time Diff Module David Clements wrote in post #23880: > 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 There is a gem available to find the difference in a useful way. https://rubygems.org/gems/time_diff This will return a hash of difference in year, month, week, day, hour, minute, second -- Posted via http://www.ruby-forum.com/.