Timestamp to Relative Time Converter

Turn a Unix timestamp into "3 hours ago" or "in 2 days".

Convert any Unix timestamp (seconds or milliseconds) into a human-readable relative time like "5 minutes ago" or "in 3 weeks". Auto-detects the unit and runs entirely in your browser — nothing is uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

Does it auto-detect seconds vs milliseconds?

Yes. In auto mode, integers with 13 or more digits are treated as milliseconds and shorter values as seconds. You can also force a unit if needed.

Timestamp to relative time

This tool turns a Unix timestamp — in seconds or milliseconds — into a human-readable phrase like “3 hours ago” or “in 2 days”. It is built for developers reading log lines, API responses or database created_at fields, where a raw epoch number tells you nothing at a glance. It also shows the exact local date and the ISO 8601 string so you can verify the conversion.

How it works

The input is parsed to milliseconds: in auto-detect mode, values of 10^12 or larger are treated as milliseconds and smaller values as seconds (you can force either unit). The tool then computes the gap between that moment and now and steps it up through divisions — seconds, minutes, hours, days, weeks, months, years — stopping at the first unit where the magnitude is below the next threshold. It uses the browser’s built-in Intl.RelativeTimeFormat so the phrasing matches your locale (“yesterday”, “last week”).

Example

The timestamp 1700000000 (seconds) is 14 November 2023, 22:13 UTC. Pasted today it reads as roughly “2 years ago”, with the exact local date and ISO string shown below.

Gap from nowRelative phrase
45 seconds ago45 seconds ago
2 hours ago2 hours ago
1 day aheadtomorrow
3 weeks aheadin 3 weeks
14 months ago1 year ago

Where this tool is most useful

Log triage. Server logs, access files, and audit trails are full of Unix timestamps. Pasting one here immediately tells you whether an event was “10 minutes ago” or “last month” without mental conversion.

API response debugging. REST APIs frequently return created_at, updated_at, or expires_at as Unix epoch values. Converting a created_at to “3 days ago” tells you whether a record is fresh or stale at a glance.

Database inspection. PostgreSQL and SQLite both store timestamps as epoch integers in some schemas. When reviewing a row in a SQL editor, pasting the raw integer here shows you the human moment instantly.

Expiry checking. JWT tokens and OAuth tokens carry exp claims as Unix seconds. Paste the exp value to see “expired 2 hours ago” or “valid for another 4 days” without converting manually.

Seconds vs milliseconds: spotting the unit

If a timestamp looks like 1700000000 — ten digits — it is almost certainly in seconds. If it looks like 1700000000000 — thirteen digits — it is milliseconds. The auto-detect mode uses this digit count to pick the right unit. If you get a date near 1 January 1970 from a value that should be recent, switch the unit: you likely have milliseconds being read as seconds, which makes the value look like a moment just after the epoch.

A few APIs use microseconds (16 digits) or nanoseconds (19 digits). Those need to be divided by 1,000 or 1,000,000 respectively before pasting.

Everything runs in your browser; no timestamp leaves the page.