How to Convert Unix Timestamps to Human-Readable Dates
Quick Answer
Unix timestamp = seconds (or milliseconds) since 1970-01-01 00:00:00 UTC. Convert to a date with new Date(timestamp * 1000) in JavaScript (seconds) or new Date(timestamp) (milliseconds). Convert a date back with Math.floor(date.getTime() / 1000). Use our Timestamp Converter to do both instantly in your browser.
Introduction
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC (the Unix epoch), excluding leap seconds. It is the lingua franca of time in computing because it is a single integer that is timezone-independent and trivially sortable. Most systems use seconds; JavaScript and many databases use milliseconds.
Step by Step
-
Understand seconds vs milliseconds
Most backend systems and APIs use seconds (10-digit timestamps until 2286). JavaScript's Date and Java's Instant use milliseconds (13-digit). Always confirm which unit an API expects β mixing them shifts the date by a factor of 1000 (off by ~31 years).
-
Convert a timestamp to a readable date
Paste the timestamp into the Timestamp Converter. It detects seconds vs milliseconds by length (10 vs 13 digits) and displays the date in UTC and your local timezone. In code: new Date(1700000000 * 1000).toISOString() returns '2023-11-14T22:13:20.000Z'.
-
Convert a date to a timestamp
Enter a date and time into the converter; it returns the Unix timestamp. In code: Math.floor(new Date('2026-08-28T12:00:00Z').getTime() / 1000) returns the epoch seconds. Always specify the timezone (Z or an offset) to avoid local-time ambiguity.
-
Handle time zones correctly
Unix timestamps are always UTC β they have no timezone. Convert to a local display only at the presentation layer. Never store local time as a timestamp; store UTC and convert on display. Use IANA timezone names (America/New_York) with Intl.DateTimeFormat for correct DST handling.
-
Calculate differences between dates
Subtract two timestamps to get the difference in seconds (or milliseconds). Divide by 60 for minutes, 3600 for hours, 86400 for days. Use our Date Difference tool for human-friendly ranges, or the Age Calculator for birth-date-based ages.
Examples
The Unix epoch
Input: 0 (seconds)
Output: 1970-01-01 00:00:00 UTC
One billion seconds after the epoch
Input: 1000000000 (seconds)
Output: 2001-09-09 01:46:40 UTC
Start of 2026 in UTC
Input: 2026-01-01T00:00:00Z
Output: 1767225600 (seconds) / 1767225600000 (milliseconds)
Difference between two dates
Input: 1767225600 - 1700000000
Output: 67225600 seconds = 778.08 days β 2 years 31 days
Common Problems
- Seconds vs milliseconds confusion: a 10-digit timestamp read as milliseconds gives a date in 1970; a 13-digit timestamp read as seconds overflows 32-bit int. Detect the unit by digit count or document it explicitly in the API.
- Storing local time as a timestamp: timestamps are UTC. If you compute Date.now() in a browser set to UTC-5 and treat the result as local, DST transitions will shift your data by an hour twice a year.
- 32-bit overflow on 2038-01-19 03:14:07 UTC (Y2038): systems using a signed 32-bit seconds timestamp cannot represent dates after this point. Use 64-bit or millisecond timestamps in new systems.
- Leap seconds are ignored: Unix timestamps skip leap seconds, so the difference between two timestamps does not equal the number of SI seconds that elapsed. Most applications can ignore this; high-precision astronomy and finance cannot.
Tips
- Always store and transmit timestamps in UTC; convert to local time only at the display layer using Intl.DateTimeFormat with an IANA timezone.
- Use ISO 8601 strings (e.g. 2026-08-28T12:00:00Z) for human-readable APIs and timestamps for storage β ISO strings carry their timezone explicitly and are unambiguous.
- When comparing timestamps, use the same unit (seconds or milliseconds) on both sides β a unit mismatch is one of the most common date bugs.
- Use our Timestamp Converter to sanity-check API responses during debugging β it shows both UTC and local time so you can spot timezone bugs immediately.