Menu
Advertisement

Time Duration Calculator for Hours, Minutes and Seconds

Find how long it is from one date and time to another, or add and subtract a list of times. Every answer comes in hours, minutes, seconds and h:mm:ss.

By Nethanel Bar, Co-founder & CEO

Last updated

Advertisement

Ready to actually learn to code?

Coddy teaches you by writing real code in your browser - interactive lessons, instant feedback, and AI help when you get stuck.

How to calculate the time between two times

Time does not add up like ordinary numbers. Seconds and minutes roll over at 60 and the clock rolls over at midnight, so 10:50 plus 25 minutes is 11:15, and 22:15 to 06:40 the next morning is 8 hours 25 minutes. The calculator turns both moments into seconds, subtracts, and splits the answer back into days, hours, minutes and seconds.

The first mode measures the time between two moments. Set a start date and time and an end date and time, with years from 1900 to 2100; both dates start on today's date from your device. The answer is written in words, such as 3 days, 8 hours, 30 minutes, and as a total in hours, in minutes, in seconds and as h:mm:ss. If the end comes before the start, the time is counted backwards and the page says so.

The second mode adds and subtracts times, like a list of lap times or video clips. Each row has hours, minutes and seconds and a + or minus sign, and a field can go past 59 or hold a decimal, such as 90 minutes or 1.5 hours. The total keeps counting past 24 hours, so a long list reads 26:03:09, which the words line spells out as 1 day, 2 hours, 3 minutes, 9 seconds.

What you will learn while working with durations

  • Time is counted in base 60. Every 60 seconds carry 1 to the minutes and every 60 minutes carry 1 to the hours, so 35 minutes 84 seconds is really 36 minutes 24 seconds.
  • The easy way to add or subtract times is to turn everything into seconds, do plain arithmetic, and convert back: 2,094 seconds is 34 minutes (2,094 divided by 60) and 54 seconds left over.
  • Elapsed time and clock time differ on the nights clocks change. Where the clocks go back an hour, midnight to 06:00 that night is 7 hours, though the clock only moved 6.
  • In Python, a datetime minus a datetime gives a timedelta, and timedeltas add and subtract like numbers. total_seconds() turns one into a single number you can divide into any unit.

How to use the time duration calculator

  1. Choose what to work out

    Pick Time between two moments to measure a gap, or Add and subtract times to total a list of times.

  2. Enter the two moments

    Set the start date as day, month and year, then its time, and do the same for the end. Both dates start on today, so for two times on the same day you only change the times. The page opens on 09:00 to 17:30, which is 8 hours, 30 minutes.

  3. Or fill in the rows

    Type hours, minutes and seconds in each row; an empty field counts as 0. Press the + sign on any row after the first to make it subtract, and press Add a time for another row.

  4. Read the result

    The duration appears in words and as a total in hours, in minutes, in seconds and as h:mm:ss. The hours and minutes totals are rounded to two decimals.

Common durations in every unit

The same length of time in the units the calculator shows. In h:mm:ss the hours keep counting past 24.

DurationAs h:mm:ssIn minutesIn seconds
1 minute0:01:00160
15 minutes (0.25 hours)0:15:0015900
30 minutes (0.5 hours)0:30:00301,800
45 minutes (0.75 hours)0:45:00452,700
1 hour1:00:00603,600
1.5 hours1:30:00905,400
8 hours8:00:0048028,800
1 day (24 hours)24:00:001,44086,400
1 week (168 hours)168:00:0010,080604,800
30 days (720 hours)720:00:0043,2002,592,000
365 days (8,760 hours)8760:00:00525,60031,536,000

Time duration examples

Overnight, across two dates

Paste a small example into the tool and change one part at a time.

The result reads 8 hours, 25 minutes. Below it: 8.42 in hours, 505 in minutes, 30,300 in seconds and 8:25:00 as h:mm:ss. With the same date on both ends it would count backwards instead.

A gap of several days

Copy the original value, run the tool, then compare the result.

The result reads 3 days, 8 hours, 30 minutes, which is 80.5 hours, 4,830 minutes or 289,800 seconds. The h:mm:ss line shows 80:30:00, because its hours do not stop at 24.

Video clips added, one cut taken out

Rows

+ 0 h 12 min 35 s + 0 h 8 min 47 s + 0 h 15 min 2 s minus 0 h 1 min 30 s

Press the + sign on the last row to turn it into a minus. The seconds add up to 84, which carries 1 minute, and the total is 0:34:54: 34 minutes, 54 seconds, or 2,094 seconds.

The same in Python

datetime and timedelta
from datetime import datetime, timedelta
start = datetime(2026, 11, 21, 9, 0)end = datetime(2026, 11, 24, 17, 30)gap = end - startprint(gap)                         # 3 days, 8:30:00print(gap.total_seconds() / 3600)  # 80.5
clips = [timedelta(minutes=12, seconds=35),         timedelta(minutes=8, seconds=47),         timedelta(minutes=15, seconds=2)]cut = timedelta(minutes=1, seconds=30)print(sum(clips, timedelta()) - cut)  # 0:34:54

Subtracting two datetimes gives a timedelta, which prints as days and h:mm:ss and can be added and subtracted. These datetimes carry no time zone, so Python counts clock time and ignores a daylight saving change; the calculator uses your device's clock and counts it.

Common mistakes with time math

  • Subtracting times like decimals. 10:15 minus 9:50 is 25 minutes, not 0:65, because the hour you borrow is 60 minutes, not 100.
  • Leaving the same date on an overnight span. 22:15 to 06:40 on one date counts backwards, so set the end date to the next day.
  • Reading the hours total as h:mm. 8.42 hours is 8 hours 25 minutes, not 8 hours 42 minutes.
  • Typing a time with a colon into Minutes or Seconds. Only the Hours field reads a clock time like 1:30 or 1:30:15; in Minutes and Seconds, type the number alone.
  • Measuring a gap over a clock change for another place. The tool reads both moments on your device's clock, so a span over a daylight saving change is right for your own time zone, not for a city with different rules.

Time duration calculator FAQ

How do I calculate the time between two times?

Turn both times into minutes after midnight, subtract, and turn the result back into hours and minutes. 17:30 is 1,050 minutes and 09:00 is 540, so the gap is 510 minutes, or 8 hours 30 minutes.

How do I add hours and minutes together?

Add the minutes, carry every 60 into the hours, then add the hours. 1:45 plus 2:30 is 3 hours 75 minutes, which is 4:15. In Add and subtract times, type each time in its own row.

Can I subtract times?

Yes. Press the + sign on any row after the first to turn it into a minus, and that row is taken off the total. A total below zero is shown with a minus sign.

What if the end time is on the next day?

Set the end date to the next day. When the end is earlier than the start, the calculator counts backwards and says so, rather than guessing which day you meant.

Does it count daylight saving time changes?

Yes. Both moments are read on your device's clock and time zone, so a span over a clock change shows the hours that really passed, one more or one fewer than the clock suggests.

How do I turn a duration into decimal hours?

Divide the minutes by 60 and add them to the hours: 2:45 is 2.75 hours. The In hours line shows this for every result, rounded to two places.

Can a field go over 59, or take a decimal?

Yes. 90 minutes or 200 seconds is fine, and 1.5 in Hours is 1 hour 30 minutes. Each row is rounded to whole seconds.

How is this different from the hours calculator?

The hours calculator is a time card: clock times per shift, breaks and pay. This page measures any span between two dates and times, and adds or subtracts times down to the second.

Learn more

Other developer tools

Coddy programming languages illustration

Learn to code with Coddy

Get started