You can see the difference in two Time objects by subtracting them: : Time Calculation « Time « Ruby






You can see the difference in two Time objects by subtracting them:


stop = Time.local( 2007, "jan", 30, 1, 15, 20 )
start = Time.local( 2008, "jan", 30, 1, 15, 20 )

puts stop - start 

 








Related examples in the same category

1.Add seconds and multiples of seconds to add to a time with +
2.Doing Time Arithmetic
3.Finding the Day of the Week
4.Is it a leap year