Unix Time to Date: Convert Unix Timestamp to Human-Readable Time
A practical guide for converting Unix time to date formats: UTC, local timezone, ISO 8601, database datetime, and human-readable output. Covers Unix timestamp to date, Linux time to date, and common seconds-vs-milliseconds mistakes.
What Unix time to date conversion means
Unix time is a number that counts elapsed time since January 1, 1970 at 00:00:00 UTC. Converting Unix time to date means turning that number into a calendar date, clock time, and timezone-aware display. The timestamp itself is timezone-neutral; UTC or local timezone only affects the way the instant is shown to humans.
The quick conversion rule
First identify the unit. A modern 10-digit Unix timestamp is usually seconds. A modern 13-digit Unix timestamp is usually milliseconds. JavaScript Date expects milliseconds, while Linux, Python, PHP, Go, and many database functions usually work with seconds.
- Unix seconds to JavaScript Date: new Date(seconds * 1000)
- Unix milliseconds to JavaScript Date: new Date(milliseconds)
- Linux command: date -u -d @1700000000
- Python UTC datetime: datetime.fromtimestamp(seconds, tz=timezone.utc)
- PostgreSQL: SELECT to_timestamp(1700000000)
Unix timestamp to date examples
Examples are the fastest way to sanity-check whether a value is seconds, milliseconds, or a different unit. If the converted year is near 1970, you probably passed seconds to an API that expected milliseconds. If the converted year is far in the future, you probably passed milliseconds to an API that expected seconds.
- 0 seconds since epoch = 1970-01-01 00:00:00 UTC
- 1700000000 seconds since epoch = 2023-11-14 22:13:20 UTC
- 1700000000000 milliseconds since epoch = 2023-11-14 22:13:20 UTC
- -86400 seconds since epoch = 1969-12-31 00:00:00 UTC
- 1767225600 seconds since epoch = 2026-01-01 00:00:00 UTC
UTC date vs local date
A Unix timestamp represents one exact instant. UTC is the safest reference for logs, APIs, and debugging. Local time is useful for user interfaces, calendars, and reports. The same Unix timestamp can display as different calendar dates in New York, London, Shanghai, and Tokyo, especially near midnight UTC.
- Use UTC when comparing events across servers or regions
- Use the user's IANA timezone when displaying dates in an app
- Use ISO 8601 with Z for machine-readable UTC output
- Use a timezone converter when a local calendar day matters
Unix time to date FAQ
- How do I convert Unix time to a date?
- Identify whether the value is seconds or milliseconds, then convert it using a timestamp converter or a language API. For JavaScript, multiply seconds by 1000 before passing the value to new Date().
- Is Linux time the same as Unix time?
- For normal timestamp conversion, yes. Linux time is Unix time: seconds since 1970-01-01 00:00:00 UTC.
- Why does my Unix timestamp convert to 1970?
- That usually means a seconds timestamp was treated as milliseconds. Multiply the 10-digit seconds value by 1000 before converting with JavaScript Date.
- How do I convert Unix time to a date in Excel?
- Excel has no Unix epoch, so divide the seconds value by 86400 and add the 1970 date serial: =A1/86400 + DATE(1970,1,1), then format the cell as a date. For milliseconds, divide by 86400000 instead.