Timestamp Difference Calculator

Calculate the exact duration between two timestamps — seconds, hours, days, and business days. Date picker or Unix input.

⏱ UnixLi — Live Tool All processing local · No data sent

Timestamp Difference Calculator

// Exact duration between two timestamps — including business days.

Input mode:
From
To

Measure the exact duration between two timestamps

Debugging a slow job, checking an SLA, or confirming how long a token lived all come down to one question: how much time passed between two moments? This calculator answers it instantly. Pick two dates with the date picker, or switch to Unix timestamps mode and paste raw epoch seconds from logs. The result shows the gap as seconds, minutes, hours, days, weeks, approximate months, approximate years, and business days — each card copies with one click, and Copy all results grabs the full breakdown for a ticket or chat.

The math happens in your browser tab. Log timestamps from production systems stay on your machine; nothing is posted to a server.

How the calculation works

Internally both inputs become JavaScript Date objects and the tool takes the absolute difference in milliseconds. From that single number it derives every unit:

The summary line also tells you the direction (whether “To” is before or after “From”), a human relative phrase, and both endpoints as UTC strings so you can double-check what was compared.

Worked example with Unix seconds

Paste 1715429912 as “From” and 1715516312 as “To”. The first value is Saturday, May 11, 2024 at 12:18:32 UTC; the second is exactly 86,400 seconds later, Sunday, May 12, 2024 at 12:18:32 UTC. The calculator reports 86,400 seconds, 1,440 minutes, 24 hours, and 1 day. Because the start falls on a Saturday and the interval only covers the weekend, the business-day count is 0.

Date picker vs Unix mode

The date picker uses your browser’s local timezone. If you enter 09:00 in Casablanca and 09:00 in New York on two machines, those are different instants. When you copy values from server logs, prefer Unix mode: epoch seconds are timezone-free, so the difference is unambiguous. Switching to Unix mode also fills the date pickers with the equivalent local times, which is a handy sanity check.

Compute the same difference in code

Once you know the expected answer, reproduce it in your service. Subtracting two Unix timestamps in seconds gives elapsed seconds directly:

JavaScript
const from = 1715429912, to = 1715516312;   // Unix seconds
const elapsed = to - from;                  // 86400
const hours = elapsed / 3600;               // 24
Go
d := time.Unix(1715516312, 0).Sub(time.Unix(1715429912, 0))
fmt.Println(d, d.Hours()) // 24h0m0s 24

Language pages have more patterns: JavaScript, Go, and the others linked from the Unix timestamp converter.

Common pitfalls when comparing timestamps

Practical uses

Engineers use the diff calculator to compare a JWT’s iat and exp (token lifetime), to measure queue latency between “enqueued” and “processed” log lines, to check how many working days remain before a release, and to confirm the countdown behind a Discord relative timestamp for a community event.

Frequently asked questions

How do I calculate the difference between two Unix timestamps?

Subtract the earlier value from the later one when both are in the same unit. For seconds, 1715516312 - 1715429912 = 86400, which is exactly one day. Switch this tool to Unix mode to see every unit at once.

How are business days counted?

The calculator steps through calendar days from the earlier date to the later one and counts Monday to Friday. Weekends are skipped; public holidays are not removed because they vary by country.

Why are months and years marked as approximate?

They are derived from elapsed days using average lengths (30.4375 days per month, 365.25 days per year). Real calendar months vary, so use calendar-aware code for billing or contract periods.

Does the date picker use UTC or my local time?

The date picker uses your browser’s local timezone. For values copied from logs or APIs, use Unix timestamps mode so the comparison is timezone-independent.

Can I measure a JWT token lifetime here?

Yes. Paste the iat value as From and the exp value as To in Unix mode. The result is the token lifetime; the JWT decoder shows those claims if you only have the raw token.

Is my data uploaded anywhere?

No. Every difference is computed locally in your browser tab. Timestamps you paste are not sent to a server or stored.

Related tools