How-To Guides

How to Convert a Unix Timestamp to a Readable Date

Learn what a Unix timestamp means and convert one to a readable date, with UTC and local time shown side by side.

A Unix timestamp looks like a random ten-digit number — 1700000000 — with no dashes, colons or timezone label, yet it pins down one exact moment in time. If you work with logs, APIs or databases, you will meet these numbers constantly. This guide explains what a Unix timestamp is, converts one fixed example, and shows the conversion in JavaScript, Python and Linux.

What Unix time represents

Unix time — also called epoch time or POSIX time — counts the seconds since 00:00:00 UTC on 1 January 1970, the Unix epoch. A timestamp of 0 is 1970-01-01 00:00:00 UTC, and 1700000000 is 1,700,000,000 seconds after that moment. The count ignores leap seconds.

Systems store time this way because one integer is easy to compare, sort and subtract. That is why timestamps appear in log lines, API responses, database columns and JSON web token claims.

Three facts matter first. A Unix timestamp has no timezone built in: it names one instant, and the date you see depends on the timezone you display it in. Most systems count in seconds, but JavaScript counts in milliseconds, so a JavaScript timestamp has thirteen digits instead of ten. And the count can be negative: -1 is one second before the epoch, 1969-12-31 23:59:59 UTC.

A few landmarks help: 1000000000 is 2001-09-09 01:46:40 UTC, 2147483647 is 2038-01-19 03:14:07 UTC (the largest time a signed 32-bit integer can hold), and 1767225600 is 2026-01-01 00:00:00 UTC.

Convert a sample timestamp step by step

The worked example uses one fixed timestamp, 1700000000: ten digits, so it is counted in seconds rather than milliseconds. Count the digits first — that single check prevents the most common conversion error.

The fastest route is FBSubNet's free Unix Timestamp Converter, which runs entirely in your browser. Paste 1700000000 and run the tool: it reports the result in UTC, in ISO format and in your browser's local time. Nothing you paste is uploaded.

Here is the result:

FormatValue
Unix timestamp (seconds)1700000000
UTC date and timeTuesday, 14 November 2023, 22:13:20 UTC
Local time, Asia/Karachi (UTC+5)Wednesday, 15 November 2023, 03:13:20 PKT
Local time, New York (UTC-5)Tuesday, 14 November 2023, 17:13:20 EST
ISO 86012023-11-14T22:13:20Z

Notice the date itself changes: in UTC the timestamp falls on Tuesday 14 November, but in Karachi — five hours ahead — it is already Wednesday 15 November, while in New York it is still Tuesday afternoon.

Convert a Unix timestamp in JavaScript

JavaScript's Date object expects milliseconds, so multiply a seconds timestamp by 1000 first:

const unixSeconds = 1700000000;
const date = new Date(unixSeconds * 1000);

console.log(date.toISOString());
// "2023-11-14T22:13:20.000Z"

console.log(date.toLocaleString());
// Local time in the browser or server timezone

The toISOString() method always returns UTC, the safest choice for logs and API responses. The toLocaleString() method returns the date in the machine's local timezone, which is what you want when showing a date to a user. You can also pin a specific timezone:

console.log(date.toLocaleString('en-US', { timeZone: 'Asia/Karachi' }));
// "11/15/2023, 3:13:20 AM"

console.log(date.toLocaleString('en-US', { timeZone: 'America/New_York' }));
// "11/14/2023, 5:13:20 PM"

If the value you already have is in milliseconds — for example, from Date.now() — do not multiply it: new Date(1700000000000) gives the same moment. The current timestamp in seconds is Math.floor(Date.now() / 1000); going the other way, Date.UTC(2026, 0, 1) / 1000 gives 1767225600 (months are zero-based, so January is 0).

Convert a Unix timestamp in Python

Python's datetime module provides fromtimestamp(). Always pass an explicit timezone so the result is not silently tied to the machine it runs on:

from datetime import datetime, timezone

unix_seconds = 1700000000

utc_dt = datetime.fromtimestamp(unix_seconds, tz=timezone.utc)
print(utc_dt)
# 2023-11-14 22:13:20+00:00

print(utc_dt.strftime('%B %d, %Y %H:%M:%S %Z'))
# November 14, 2023 22:13:20 UTC

Without a timezone, fromtimestamp() returns local time — fine on your own machine, but risky in shared code, where the same script prints a different date on a server elsewhere. The older utcfromtimestamp() is deprecated: it returns a "naive" datetime with no timezone attached.

Millisecond timestamps need one extra step: divide by 1000, because fromtimestamp() expects seconds:

unix_ms = 1700000000000
utc_dt = datetime.fromtimestamp(unix_ms / 1000, tz=timezone.utc)
print(utc_dt.isoformat())
# 2023-11-14T22:13:20+00:00

The current time is time.time(), a float in seconds. To convert a date back, call .timestamp() on an aware datetime: datetime(2026, 1, 1, tzinfo=timezone.utc).timestamp() returns 1767225600.0.

Convert a Unix timestamp on the Linux command line

On Linux, GNU date converts a timestamp with the -d flag and an @ prefix, printing the date in the system's local timezone:

date -d @1700000000
# Tue Nov 14 22:13:20 UTC 2023

TZ='UTC' date -d @1700000000
# Tue Nov 14 22:13:20 UTC 2023

TZ='Asia/Karachi' date -d @1700000000
# Wed Nov 15 03:13:20 PKT 2023

Setting TZ for a single command forces a specific timezone without changing anything else. A + format string controls the output exactly: date -d @1700000000 '+%Y-%m-%d %H:%M:%S' prints 2023-11-14 22:13:20, and --iso-8601=seconds prints 2023-11-14T22:13:20+00:00. Going the other way, date +%s prints the current timestamp and date -d '2026-01-01 UTC' +%s prints 1767225600. On macOS and BSD the syntax differs — date -r 1700000000 — and a thirteen-digit timestamp needs dividing by 1000 first: date -d @$((1700000000000 / 1000)).

Seconds vs milliseconds: the mistake that breaks most conversions

Almost every wrong conversion comes down to mixing up seconds and milliseconds. The two units differ by a factor of 1000, so the error is never subtle — it is always wildly wrong, which makes it easy to spot.

DigitsUnitExample
10Seconds1700000000
13Milliseconds1700000000000
16Microseconds1700000000000000
19Nanoseconds1700000000000000000

Count the digits before you convert. If you feed a thirteen-digit millisecond value to a tool that expects seconds, you get a date in the year 55840 — the Linux command date -d @1700000000000 literally prints 55840-11-08. That impossible year is the giveaway: divide by 1000 and try again. The opposite error is just as obvious: dividing a seconds value by 1000 before converting gives a date in January 1970 — converting 1700000000 / 1000 as seconds gives 20 January 1970.

When a data source does not document its unit, the digit count is usually enough: APIs and databases normally use seconds, JavaScript's Date.now() uses milliseconds. If the count is ambiguous, convert it both ways and keep the result in a sensible range.

Handle timezones correctly

A Unix timestamp itself has no timezone: 1700000000 is the same instant everywhere on Earth. Timezones only matter when you display that instant as a date and time.

Store and exchange timestamps in UTC, converting to local time only at the moment of display. That is why toISOString(), fromtimestamp(ts, tz=timezone.utc) and TZ='UTC' date are the defaults to reach for: they all agree. If two systems disagree about a date, check whether one converted to local time and the other did not.

Daylight saving time is where this goes wrong most often. New York was five hours behind UTC on 14 November 2023, so 1700000000 displayed as 17:13:20 EST — but on 24 March 2024, with daylight saving time in effect, 1711238400 (midnight UTC) displayed as 20:00:00 EDT the previous evening, only four hours behind. A fixed offset like "-5 hours" would be wrong for half the year, so convert with a named timezone such as America/New_York and let the system apply the correct offset.

Some timezones make this easy: Asia/Karachi stays at UTC+5 all year, so 1700000000 is always 03:13:20 the next morning there. When you write a date for other people, include the timezone or use ISO 8601 with a Z or an explicit offset, such as 2023-11-14T22:13:20Z: a bare date without a timezone is ambiguous by design.

Convert a date back to a Unix timestamp

Conversion runs in both directions — for example, to store a user-picked date. Be explicit about the timezone, because a date without one is ambiguous.

// JavaScript: Date.UTC returns milliseconds
Date.UTC(2026, 0, 1) / 1000
// 1767225600

# Python
from datetime import datetime, timezone
datetime(2026, 1, 1, tzinfo=timezone.utc).timestamp()
# 1767225600.0

# Linux
date -d '2026-01-01 UTC' +%s
# 1767225600

All three agree: 1 January 2026 at midnight UTC is 1767225600. The trap is passing a local date without naming its timezone: midnight in Karachi that day is 1767207600, five hours earlier, and storing the wrong one shifts every downstream date by five hours.

Troubleshooting: when the converted date looks wrong

Most conversion problems fall into a few patterns, each with a distinctive symptom:

  • The year is 55840 or similarly far in the future. You fed a millisecond timestamp to something expecting seconds — divide by 1000 first.
  • The date is in January 1970. You divided a seconds timestamp by 1000, or fed seconds to a function expecting milliseconds.
  • The time is off by a few hours. One side used local time and the other used UTC. Decide which timezone the result should be in.
  • The date is off by one day. A timestamp late in the evening in UTC is already the next day in timezones ahead of UTC, as the Karachi example above shows.
  • The result is off by exactly one hour. Daylight saving time: a fixed offset was applied instead of a named timezone.
  • The timestamp is negative. That is not necessarily an error — negative values are dates before 1 January 1970 — but check the value was not truncated or parsed as a signed 32-bit integer.
  • The date is 19 January 2038. A 32-bit signed integer overflowed: the largest such value is 2147483647. Modern 64-bit systems do not have this limit, but old databases and file formats still do.

When in doubt, cross-check with a second method: convert the same value with the Unix Timestamp Converter and with a date command. If both agree, the timestamp is fine and the bug is in the code that consumed it.

Frequently asked questions

What is a Unix timestamp?

It is the number of seconds since 00:00:00 UTC on 1 January 1970 — one exact moment in time as a single integer.

How do I tell seconds from milliseconds?

Count the digits: ten means seconds, thirteen means milliseconds. A current timestamp is around 1.7 billion in seconds, 1.7 trillion in milliseconds.

Why does the same timestamp show a different date in different countries?

Because the timestamp names an instant, not a calendar date: each timezone displays that instant on its own clock.

Can a Unix timestamp be negative?

Yes. Negative values count seconds before the epoch, so -86400 is 31 December 1969 — though some older tools and formats do not handle them.

What is the biggest Unix timestamp?

Signed 32-bit systems stop at 2147483647 (19 January 2038); 64-bit systems can represent times billions of years in either direction.

It comes down to three habits: count the digits, convert in UTC unless you have a reason not to, and name the timezone explicitly when you display local time. With those habits, the worked example here — 1700000000 is Tuesday 14 November 2023 at 22:13:20 UTC — reproduces exactly on any machine. To check a value without code, paste it into FBSubNet's Unix Timestamp Converter. And if your logs carry timestamps alongside email addresses, read How to Redact Email Addresses in Example Logs next — it shows how a redaction pass can accidentally mangle the timestamps in a log line.