Timestamp difference — time between two dates or Unix timestamps

Enter two moments, as ISO 8601 dates or Unix timestamps in seconds, milliseconds, microseconds or nanoseconds, and get the gap as a calendar difference, an ISO 8601 duration and exact totals in seconds, minutes, hours, days and weeks.

Live demo · real result from this tool
Used for dates written without a time zone.
Difference9 months, 1 day, 12 hours, 30 minutes
Compact
274d 12h 30m
ISO 8601 duration
P274DT12H30M

Total

UnitValue
Seconds23,718,600
Minutes395,310
Hours6,588.5
Days274.520833
Weeks39.2173
Milliseconds23,718,600,000

Instants

UTCUTC (ISO)
Start2026-01-01T00:00:00.000Z2026-01-01T00:00:00Z
End2026-10-02T12:30:00.000Z2026-10-02T12:30:00Z

Processed on your device — nothing is uploaded.

How to use the timestamp diff calculator

  1. Enter Start (date or Unix timestamp), for example 2026-01-01T00:00:00Z or 1700000000.
  2. Enter End (date or Unix timestamp) in either form.
  3. Pick a Time zone if either value is a date without Z or an offset. UTC is the default.
  4. Read the Difference, Compact and ISO 8601 duration results, then the Total table. If the end is before the start, every value is negative.

What it does and when to use it

Use it to check how long a job or incident lasted from two log lines, or to find a token’s lifetime from its iat and exp claims. The calendar view suits people; the totals are what you put into code.

To convert a single timestamp to a date, use the Unix timestamp converter. To turn a raw number of milliseconds into readable text, use the duration humanizer. For counting working days rather than elapsed time, use business days between dates.

How it works

Each input is parsed into a moment in milliseconds:

  • Numbers are Unix timestamps, with the unit detected by size.
  • Dates of the form YYYY-MM-DD or YYYY-MM-DDTHH:mm[:ss] without an offset are read in the chosen time zone, including daylight-saving changes.
  • Other date strings with Z or an offset go to the browser’s date parser.

The exact difference is end minus start. For the calendar line, whole months are added to the earlier moment (counted in UTC, with month ends clamped). The rest is split into days, hours, minutes and seconds. Everything runs in your browser.

Worked examples

1 January to 15 March 2024, 12:30 UTC. February 2024 has 29 days:

Difference: 2 months, 14 days, 12 hours, 30 minutes
Compact: 74d 12h 30m
ISO 8601 duration: P74DT12H30M
Days | 74.520833

Two Unix timestamps in seconds, 1700000000 and 1700086400:

Difference: 1 day
Seconds | 86,400

A daylight-saving day. Noon to noon on 28–29 March 2026 in Europe/London crosses the spring change, when the clocks go forward:

Difference: 23 hours
Start | 2026-03-28T12:00:00.000Z | 2026-03-28T12:00:00+00:00
End | 2026-03-29T11:00:00.000Z | 2026-03-29T12:00:00+01:00

Limits and tips

  • Calendar parts are counted in UTC. Near a DST change, the Difference line can say “23 hours” where a person would say “1 day”. The totals are always exact.
  • Use ISO dates. 04/01/2026 is read differently by different parsers; write 2026-04-01.

Frequently asked questions

How does it tell seconds from milliseconds?
By size. Numbers below 100,000,000,000 are read as seconds, below 10^14 as milliseconds, below 10^17 as microseconds, and anything larger as nanoseconds. You can mix forms, such as a seconds value as the start and a date as the end.
What does the Time zone menu change?
Only dates written without an offset, such as 2026-03-28T12:00. Those are read as wall-clock time in the chosen zone. Timestamps and dates ending in Z or +05:30 are absolute and are not affected. The Instants table then shows both moments in UTC and in that zone.
Why is 31 January to 28 February "1 month"?
When a month is added to a day that does not exist in the next month, the date is clamped to the month's last day. So 31 January plus one month is 28 February (29 in a leap year). The totals table still shows the exact 28 days.
Why does the ISO duration show days instead of months?
The ISO 8601 and Compact outputs use only days and smaller units, because those have a fixed length. The months-and-days view is the Difference line at the top.
Can I type "yesterday" or "next Friday"?
No. Relative words are not parsed; the tool reports that it could not read the date. Use a Unix timestamp or an ISO 8601 date.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close