Time Difference Calculator

Compute the duration between any two timestamps. Returns days, hours, minutes, seconds — plus total seconds and the ISO 8601 duration string (PT2H30M). Accepts ISO 8601 dates, Unix timestamps, or any string Date() can parse.

How to use the Time Difference Calculator

Type or paste two timestamps. Accepted formats: ISO 8601 (2026-05-28T12:34:56Z), Unix seconds (1700000000), Unix milliseconds (1700000000000), or human dates (May 28, 2026). The difference updates live; signed (start > end produces negative durations).

A developer-oriented duration calculator

This calculator is built for timestamps in the formats code actually produces. It accepts ISO 8601 (2026-05-28T12:34:56Z), Unix seconds, Unix milliseconds, and anything the JavaScript Date parser understands, then returns the gap as days, hours, minutes, and seconds, a total in seconds, and the ISO 8601 duration string (PT2H30M).

It is signed: if the start is later than the end you get a negative duration, which helps when you are diffing log timestamps and do not yet know their order. For human-facing "years, months, days" breakdowns, the duration-between-dates tool is the better fit.

Common use cases

  • Log analysis — measure elapsed time between two log timestamps even when they are in different formats.
  • API and performance work — turn two Unix timestamps into a readable duration.
  • Generating ISO 8601 durations — get a PT… string for a config, schema, or API field.
  • SLA and timeout math — confirm the exact number of seconds between two events.
  • Quick conversions — how many seconds from now until a deadline timestamp.

Frequently asked questions

What input formats does it accept?

ISO 8601 date-times, Unix seconds, Unix milliseconds, and human-readable strings the browser Date parser can read. It detects which you pasted, so you can mix formats between the two fields.

What is the ISO 8601 duration format?

It is written as PnYnMnDTnHnMnS, where the T separates date parts from time parts. PT2H30M is two hours thirty minutes; P1Y2M10D is one year, two months, ten days.

Why is my duration negative?

Because the start is later than the end. The result is signed on purpose, so a reversed pair gives a negative value rather than silently flipping the order.

How is this different from the duration-between-dates tool?

This one focuses on parsing machine timestamps and emitting an ISO 8601 duration, signed. The duration-between-dates tool uses date pickers and returns a calendar decomposition (years, months, days) for human reading.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: