Skip to main content

Duration Calculator

Subtracts a start time from an end time to return the duration in hours/minutes/seconds, plus the same total in hours, minutes, and seconds alone. Time format toggles between 12-hour (with AM/PM) and 24-hour, and a Now button on either field captures the current device time. If end time falls earlier than start, an Allow Crossing Midnight toggle (default on) adds 24 hours; an optional step-by-step view shows the derivation.

Runs entirely in your browser

This tool sends nothing over the network. Everything you enter is processed on your device and never reaches our servers.

Productivity
Scheduling
Time Management
Loading the tool
Reference

Documentation

The duration calculator finds the exact elapsed time between a start time and an end time on a given day, expressed in hours, minutes, and seconds. Times can be entered in 12-hour format with AM/PM or in 24-hour format, where hours run from 0 to 23; both formats describe the same 24-hour day, so switching between them changes only how each hour is labeled, not the underlying time.

  • Start time and end time are each set from separate hour, minute, and second values; the format chosen, 12-hour or 24-hour, determines whether an AM/PM designation applies to each value.
  • Internally, both times reduce to a single count of seconds since midnight before the subtraction runs, which is what lets the same logic handle 12-hour input, converted to its 24-hour equivalent first, and 24-hour input identically.
  • The result is given both as a human-readable hours-minutes-seconds breakdown and as a single total expressed purely in hours, minutes, or seconds, the latter useful when the duration needs to feed into a spreadsheet formula or a payroll system that expects one numeric unit rather than three.
  • Settings includes a step-by-step calculation view, showing both times converted to total seconds and the subtraction that produces the duration.
  • An option to allow crossing midnight treats an end time earlier than the start time as falling on the following day, adding 24 hours, or 86,400 seconds, to the total before subtracting; this is what makes an overnight shift or a red-eye flight compute correctly instead of returning a negative duration. Restricting the calculation to the same day disables that adjustment, so an end time earlier than the start time is instead treated as an input error.

A shift starting at 22:00 (10:00 PM) and ending at 06:00 (6:00 AM) the next day, with crossing midnight allowed, converts to 79,200 seconds since midnight for the start and 21,600 seconds for the end. Because the end value is smaller than the start value, 86,400 seconds, 24 hours, is added to the end time first, giving 108,000 seconds. Subtracting the start from that adjusted end, 108,000 minus 79,200, leaves 28,800 seconds, which is exactly 8 hours: the length of the overnight shift.

Elapsed time between two times of day comes up across personal and professional scenarios: a commute, a work shift, or a recipe's time from prep to plate, each reducible to a start time and an end time.

  • Workplace: clock-in and clock-out times give the length of a work shift, useful for hourly employees, freelancers, and managers verifying timesheet entries or calculating overtime; a shift that spans midnight needs the crossing-midnight option enabled so the result comes back positive instead of negative.
  • Education: the duration of a study session, lecture, or exam, tracked per subject to spot time-management patterns and refine a study schedule.
  • Cooking: the time from when ingredient preparation began to when a dish comes out of the oven, logged as total preparation and cooking duration for a multi-step recipe that runs across several stages.
  • Fitness: start and finish times for a workout, run, or cycling session, logged as elapsed duration in a training journal without a dedicated stopwatch.
  • Travel: departure and arrival times give flight or commute duration, including overnight cases such as red-eye flights and overnight train journeys that cross midnight and rely on the same crossing-midnight adjustment used for an overnight work shift.
  • Scheduling: the gap between two logged events, checked in hours and minutes against a required interval, such as confirming a minimum rest period or a response window has been met.
  • Event Planning: the running time of an event, meeting, or conference, compared against its planned duration to improve scheduling accuracy for future events.
  • Payroll: total hours worked in a shift, convertible to decimal hours for payroll software that requires a numeric hour entry rather than hours and minutes; the decimal total is the same purely-numeric figure the calculator already reports alongside the hours-minutes-seconds breakdown.
Inputs, outputs, and what the Duration Calculator computes

What the Duration Calculator asks for and what it returns, as a plain list. Defaults, units, and ranges are the ones the form loads with.

Inputs

  • 12-hour / 24-hour · default: 12-hour
  • Hour
  • Minute
  • Second
  • AM/PM · default: AM
  • Allow crossing midnight (if end time is earlier than start time, assume next day) · default: on
  • Show step-by-step calculation · default: off

Controls

Calculate · Reset

Example

A shift starting at 22:00 (10:00 PM) and ending at 06:00 (6:00 AM) the next day, with crossing midnight allowed, converts to 79,200 seconds since midnight for the start and 21,600 seconds for the end.