Skip to main content

Dates & workdays

Time Duration Calculator: Time Between Two Dates or Two Times

Calculate duration between two timestamps. Same-day (two times) or multi-day (two dates). Decimal days and hours for payroll. Handles overnight spans and reversed dates.

By Jeff Beem

Updated

01

Mode

::
::
Duration

8 Hours, 30 Minutes


Days (dec): 0.35417

Hours (dec): 8.50000

Minutes: 510

Seconds: 30,600

02

Notes

Duration formula

End minus start. Same-day mode: if end clock is before start, we add 24h to end (overnight span).

Total seconds
Decimal hours (payroll)
Decimal days

Duration Between Two Points in Time

Duration is the span between two moments. Same-day intervals use two times (AM/PM); multi-day spans use two full timestamps. The result shows days, hours, minutes, seconds plus decimal forms for payroll and project tracking.

How It Works

Same-Day Span

Enter Start and End times. If End falls before Start (e.g., night shift), the calculator adds 24 hours to End so the span crosses midnight correctly.

Multi-Day Span

Pick Start and End datetimes. The result is days, hours, minutes, and seconds. Useful for project timelines, meeting prep, or any interval spanning midnight or weeks.

Now Button

One click fills the field with the current time or datetime. Reduces data-entry errors when you start or stop a task and need to log the moment.

Decimal Output

Total Days and Total Hours appear as decimals (e.g., 1.75 hours for 1h 45m). Payroll systems often bill in decimal hours, this matches that format.

Reversed Dates

If Start is after End, the calculator shows the absolute span and notes that the dates were reversed. You still get the right duration without fixing the order.

Point-to-Point

Time is a point (8:30 AM); duration is the distance between two points. This tool measures that distance, the length of the interval.

Time Duration Calculator: Time Between Two Dates or Two Times

Calculate the exact duration between two timestamps. Same-day (two times) or multi-day (two dates). Decimal days and hours for payroll. Reversed dates handled automatically. Free, runs locally.

What This Calculator Does

This time duration calculator finds the exact span between two points in time. Use Between Two Times for same-day intervals (e.g., 9:00 AM to 5:30 PM) or Between Two Dates for spans that cross midnight or cover multiple days. The result is displayed in days, hours, minutes, and seconds, plus decimal-day and decimal-hour equivalents for payroll and billing systems. If the end time is before the start time in same-day mode, the calculator assumes an overnight span and adds 24 hours automatically, so 11 PM to 7 AM correctly shows 8 hours. Reversed dates are handled gracefully: you still get the correct absolute duration with a note that the inputs were swapped. A Now button fills either field with the current time or datetime so you can log the moment without looking at a clock. Click Copy Result to export the full breakdown for timesheets, invoices, or project reports.
  • Same-day mode:
    Enter start and end times with hour, minute, second, and AM/PM selectors.
  • Multi-day mode:
    Use datetime pickers for start and end dates and times across any number of days.

How the Math Works

The calculator converts both timestamps to milliseconds, computes the absolute difference, and divides to get total seconds. The core formula: Duration (s)=EndmsStartms÷1000\text{Duration (s)} = |\text{End}_{\text{ms}} - \text{Start}_{\text{ms}}| \div 1000. From total seconds, days are s÷86400\lfloor s \div 86400 \rfloor, remaining hours are (smod86400)÷3600\lfloor (s \bmod 86400) \div 3600 \rfloor, and so on for minutes and seconds. Decimal forms divide total seconds directly: Decimal hours=s÷3600\text{Decimal hours} = s \div 3600 and Decimal days=s÷86400\text{Decimal days} = s \div 86400. For same-day mode, if the end time is earlier than the start, 24 hours (86,400 seconds) are added to the end before subtraction, matching overnight shift logic. For multi-day mode, full calendar dates are used so month and year boundaries are handled correctly.
  • Worked example:
    9:15 AM to 5:45 PM → difference = 8h 30m = 30,600 seconds. Decimal hours = 30,600 ÷ 3,600 = 8.50. Decimal days = 30,600 ÷ 86,400 ≈ 0.354.
  • Overnight example:
    11:00 PM to 7:00 AM. End is before start, so add 24h: effectively 31:00 − 23:00 = 8 hours.

How to Use This Calculator

Select your mode: Between Two Times for intervals within a single day, or Between Two Dates for spans that cross midnight or cover multiple days. In same-day mode, set the start and end times using the hour, minute, second, and AM/PM selectors, overnight shifts where end is before start are detected automatically and show the correct duration. In multi-day mode, use the datetime pickers to choose start and end dates and times. Click the Now button on either field to fill it with the current time or datetime, which is useful when logging a task you just finished. The results panel shows the duration in days, hours, minutes, and seconds, plus Total Days (Decimal) and Total Hours (Decimal) for payroll or billing verification. Click Copy Result to paste the full breakdown, duration, decimal days, decimal hours, total minutes, and total seconds, into a timesheet, invoice, or report.

How the Time Duration Calculator Works

Duration is the difference between two points in time. The core formula is Duration (seconds)=EndmsStartms÷1000\text{Duration (seconds)} = |\text{End}_{\text{ms}} - \text{Start}_{\text{ms}}| \div 1000; from total seconds, we derive days, hours, minutes, and seconds. Decimal forms: Days=seconds÷86,400\text{Days} = \text{seconds} \div 86{,}400 and Hours=seconds÷3,600\text{Hours} = \text{seconds} \div 3{,}600.

Same-Day vs. Multi-Day Mode

  • Between Two Times:
    For intervals on one day (e.g., 9 AM to 5 PM). Enter Start and End with AM/PM. If End is before Start, the tool assumes an overnight span and adds 24 hours to End, 11 PM to 7 AM gives 8 hours.
  • Between Two Dates:
    For spans across days or weeks. Use the datetime pickers. If Start is after End, you still get the correct span; the calculator notes the reversal.

Decimal Hours for Payroll and Billing

Many timesheet systems use decimal hours: 1 h 45 m=1+4560=1.75 hours1\text{ h }45\text{ m} = 1 + \frac{45}{60} = 1.75\text{ hours}. Billing 1h 45m as 1.45 would underpay; 1.75 is correct. This calculator outputs Total Hours (Decimal) and Total Days (Decimal) so you can verify payroll or project billing.

Time Duration Calculator FAQ

How do I calculate the time between two times on the same day?

Pick "Between Two Times" and enter Start and End using hour, minute, second, and AM/PM. The duration uses Duration=EndStart\text{Duration} = \text{End} - \text{Start} in seconds. If End is earlier than Start (e.g., 11 PM → 7 AM), the tool treats it as an overnight span and adds 24 hours to End before subtracting, so you get 8 hours, not a negative value.

How do I find the duration between two dates?

Use "Between Two Dates" and pick Start Date & Time and End Date & Time. The result is the absolute span in days, hours, minutes, and seconds. If you enter Start after End, the calculator still shows the correct duration and mentions that the dates were reversed.

What does the Now button do?

Now fills that field with the current time (single-day mode) or full date and time (multi-day mode). Handy when you forgot to start a timer or just clocked out, no need to look at a clock and type.

Why does 11 PM to 7 AM show 8 hours?

End (7 AM) is before Start (11 PM). The calculator assumes an overnight shift: it effectively adds 24 hours to End, so the span is 8 hours. Same logic as a graveyard shift or any interval that crosses midnight.

What gets copied when I click Copy Result?

Copy Result pastes the full result block: the main duration (e.g., 2 Days, 1 Hour, 1 Minute), Total Days (Decimal), Total Hours (Decimal), Total Minutes, and Total Seconds. Ready to drop into timesheets or reports.

Time & Date Reference Note

Informational Use: These tools use standard date/time algorithms and your browser’s timezone data (IANA). Results are intended for general reference and planning only.

Verification Recommended: Time zone rules and daylight saving changes vary by region and year. For critical scheduling, payroll, or legal deadlines, confirm results with official sources.

Local Verification: Always confirm times, dates, and business-day counts with official sources or qualified professionals when stakes are high.

© 2026 CalcRegistry Reference Last Logic Update: May 2026Free Online Utility Tools