From: James Edward Gray II Date: 2005-12-14T23:21:30+09:00 Subject: Re: convert seconds to hours:minutes:seconds On Dec 14, 2005, at 8:09 AM, Steve Litt wrote: > #!/usr/bin/ruby > b4 = Time.new > sleep(3) > after = Time.new > interval = after.to_i - b4.to_i You can just subtract normally. Time knows what to do: interval = after - b4 > print "Started at ", b4.asctime, ", ended at ", after.asctime > print "\n Interval is ", interval.to_s, ".\n" It's a good idea to get into the habit of using interpolation with Ruby. That let's Ruby take care of stringifying your values. We can also lose those \n characters: puts "Started at #{b4} and ended at #{after}." puts "Interval is #{interval}." James Edward Gray II