From: Kirk Haines Date: 2011-03-10T01:43:14+09:00 Subject: Re: convert time to ruby time to calculate the time difference. On Wed, Mar 9, 2011 at 9:37 AM, ABHILASH M.A wrote: > Brian Candler wrote in post #942410: >> Alternative: >> >>>> require 'time' >> => true >>>> t1 = Time.parse("12:35:10.000757") >> => Mon Sep 20 12:35:10 +0100 2010 >>>> t2 = Time.parse("12:35:10.000759") >> => Mon Sep 20 12:35:10 +0100 2010 >>>> t2 - t1 >> => 2.0e-06 > > If you got the ruby time, you can use the gem 'time_diff' to get the > time difference in a useful format like year, month, week, day, hour, > minute, second I haven't looked at the gem, but....it's all just simple math, except for the month part, which takes a bit more work. Does the gem _actually_ calculate the difference in months between two dates, or does it just approximate it? Kirk Haines Software Engineer EngineYard