Datetime Duration

Enter a start and an end.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

The result is days, hours, minutes, and seconds.

Time zones are the ones written in the values. A bare date is treated as local midnight by the browser.

How to use it

  1. Open this page and provide the input it asks for.
  2. Set the options that are visible, then use Measure duration.
  3. Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.

Limitations

A day here is 86400000 milliseconds

What the browser does with each box

Both boxes are parsed with the ordinary date parser. A date-only value such as 2024-03-10 is UTC midnight. A date and time with no offset, such as 2024-03-10T12:00, is interpreted in the browser’s local zone. A value that ends in Z is UTC. A numeric offset written on the text is honored when the parser accepts it. If either value cannot be parsed, the page asks for both date and time values. It does not assume “now” for a blank box.

The raw gap is end minus start in milliseconds. A negative gap is reported with a single leading minus. The parts after that minus are the absolute gap, broken with floor division: days of 86400000 milliseconds, then hours of 3600000, then minutes of 60000, then whole seconds. Any leftover fraction of a second is dropped. The readout is not years and months. A span of 40 days stays 40 days, 0 hours, 0 minutes, 0 seconds. It is not rewritten as one month and some days.

Why noon to next noon can be 23 hours

Daylight-saving transitions change the local clock without changing the length of a millisecond. In a zone that springs forward, local noon and the next local noon are 23 hours of elapsed time. This page will say 0 days, 23 hours, 0 minutes, 0 seconds for that pair. In a zone that falls back, the same clock reading a day later can be 25 hours. The breakdown follows the instants, not the labels on the clock. A civil “one day” and this readout agree only when the local day really contained 86400 seconds.

That is the split between a clock string and a timestamp. The boxes look like clocks, but the math starts only after each box has been turned into an instant. Two clocks with no date cannot take this path, because a bare hour has no zone and no midnight to cross. Use the time calculator for H:MM arithmetic that must ignore the calendar. Use this page when the two instants are known and you want the elapsed pieces, including a shorter or longer local day.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.