SMT

Timestamp Comparison

Compare any two timestamps — Unix seconds, Unix ms, ISO 8601, or date strings. See the exact diff and formats side-by-side.

Compare A vs B

Enter two timestamps to compare

Accepts Unix seconds, Unix ms, ISO 8601, or any date string

Comparing Unix Timestamps

Comparing two Unix timestamps is fundamental to many development tasks: determining if a session has expired, measuring the latency between two log events, verifying that a scheduled job ran on time, or checking that an API response arrived within an SLA window.

Because Unix timestamps are plain integers, the comparison is just subtraction. The difference in seconds can be converted to any human-readable unit — this tool does it instantly for milliseconds, seconds, minutes, hours, days, weeks, and months.

Common Comparison Use Cases

Log correlation

Find how far apart two events in separate log files occurred

Token validation

Check if a JWT exp claim is still in the future vs. current time

Performance measurement

Calculate the duration of a database query or API call

SLA verification

Confirm an incident was resolved within the agreed response time

Deployment diffs

Compare when two releases were deployed

Data freshness

Check if a cache or feed was updated recently enough

Frequently Asked Questions

How do I compare two Unix timestamps in code?

Simply subtract one from the other: diff_seconds = ts_b - ts_a. For milliseconds divide by 1000, for minutes divide by 60, for hours by 3600, for days by 86400.

Can I compare an ISO 8601 date with a Unix timestamp?

Yes. Enter the ISO date (e.g. 2024-01-15T10:30:00Z) in one field and the Unix timestamp in the other. The tool converts both to a common representation before comparing.

What does a negative diff mean?

A negative result means Timestamp A is later than Timestamp B — i.e. B came before A. If you want A to always be the earlier event, swap the values.

How do I know if a timestamp is in seconds or milliseconds?

Count the digits. A 10-digit number is seconds (e.g. 1700000000 = Nov 2023). A 13-digit number is milliseconds. A 16-digit number is microseconds. This tool auto-detects the unit.

Do timezones affect the comparison?

Not for Unix timestamps — they are always UTC. For date strings that include a timezone offset (e.g. "2024-01-15T10:30:00+05:30"), the offset is applied before comparison, so the result is timezone-correct.