Everyday Calculation

Free calculators and unit converters for general and everyday use.

Calculators » Date & Time » Time Difference

Time Duration Calculator

Our online tools will provide quick answers to your calculation and conversion needs. On this page, you can calculate time difference between two clock times. Find time duration in hours, minutes and seconds between any two times.

Enter time as hh:mm:ss e.g., 12:45

12-hour 24-hour

Result window

To calculate hours worked or sum up a group of time intervals, use our timesheet calculator.

Download: Use this time calculator offline with our all-in-one calculator app for Android and iOS.

Time interval formula

To calculate time difference, we convert both time values to seconds since midnight using the following formula:
timem = hh*3600 + mm*60 + ss

if (start_timem < end_timem)
T = end_timem - start_timem
else
T = 86400 - start_timem + end_timem

where,
timem - Time in seconds since midnight
T - Time interval in seconds

Now convert the time interval to hours, minutes and seconds to arrive at the final result.
h = ⌊T/3600⌋, min = ⌊T/60⌋ mod 60, sec = T mod 60

The steps listed above are for 24-hour time format.

Sample calculation: Find time duration between 09:00AM and 05:00PM.

Ans. The time duration is 8 hour(s), 0 minute(s), and 0 second(s).
Time difference in hours: 8
Time difference in minutes: 480
Time difference in seconds: 28800

© everydaycalculation.com