Time Duration Calculator

When the Gap Spans Days, Simple Subtraction Breaks Down

Subtracting one clock time from another works fine within a single day, but as soon as a start and end point straddle midnight — or several days — the calculation needs to account for full calendar days in between, not just the hours and minutes on the clock face. This calculator combines each date with its time into a single timestamp, subtracts the two, and reports the exact duration in days, hours, minutes, and seconds, along with the total in hours and minutes.

The Logic

Duration = End Date/Time − Start Date/Time
Days = Total Seconds ÷ 86,400
Hours = (Total Seconds mod 86,400) ÷ 3,600
Minutes = (Total Seconds mod 3,600) ÷ 60
Seconds = Total Seconds mod 60

A Worked Example

From 8:30 AM on July 17, 2026 to 5:45 PM on July 20, 2026:

Example duration calculation
MetricValue
Duration3 days, 9 hours, 15 minutes, 0 seconds
Total seconds292,500
Total minutes4,875.00
Total hours81.25

Where This Calculation Matters

  • Hourly billing and payroll — converting clock-in and clock-out timestamps that span an overnight shift into exact billable hours.
  • Process and task timing — measuring how long a multi-day task actually took from start timestamp to completion timestamp.
  • Travel duration — working out total trip time between a departure timestamp and an arrival timestamp in a different time of day.

How to Use This Calculator

  1. Enter the start date, and optionally a start time (defaults to 00:00 if left blank).
  2. Enter the end date, and optionally an end time (defaults to 00:00 if left blank).
  3. Select Calculate to see the duration broken into days, hours, minutes, and seconds, plus the totals in hours and minutes.

Related Calculations

If the start and end are in different time zones, convert them to a common zone first with the Time Zone Calculator. For a calendar-style breakdown into years, months, and days instead, see the Date Difference Calculator.