Skip to main content

← Back to blog

The Complete Guide to Unix Timestamps (Seconds, Milliseconds, Time Zones)

If you’ve worked with logs, databases or APIs, you’ve seen a number like 1700000000 standing in for a date. That’s a Unix timestamp, and understanding it removes a whole category of time-related bugs. Here’s the complete picture.

What is a Unix timestamp?

A Unix timestamp is the number of seconds elapsed since the Unix epoch — 00:00:00 UTC on 1 January 1970. Because it’s counted from a fixed point in UTC, it’s a single absolute number that means the same thing everywhere on Earth, independent of time zone.

That property is exactly why systems love it: two servers in different countries can compare timestamps directly, with no time-zone math.

Seconds vs. milliseconds

This is the number-one source of confusion. Different platforms use different units:

  • Seconds — a 10-digit number, e.g. 1700000000. Common in Unix tools, databases, and many APIs.
  • Milliseconds — a 13-digit number, e.g. 1700000000000. JavaScript’s Date.now() returns this.

A quick rule of thumb: 10 digits = seconds, 13 digits = milliseconds. If a date comes out around the year 1970, you probably passed milliseconds where seconds were expected (or vice versa). Our timestamp converter auto-detects the unit from the digit count, so you don’t have to guess.

Time zones and UTC

A timestamp itself has no time zone — it’s an absolute instant. The time zone only matters when you display it. The same timestamp 1700000000 is:

  • 2023-11-14 22:13:20 in UTC
  • 2023-11-15 06:13:20 in UTC+8 (Taipei)

Both are the same moment, shown in different zones. When debugging, always confirm which zone a displayed time is in — our converter shows both your local time and UTC side by side to avoid mistakes.

Converting in code

Most languages make conversion straightforward:

// JavaScript (milliseconds)
const now = Date.now();               // 1700000000000
const date = new Date(1700000000000); // Date object
const seconds = Math.floor(Date.now() / 1000);
# Python (seconds)
import time
now = int(time.time())                # 1700000000
from datetime import datetime, timezone
dt = datetime.fromtimestamp(1700000000, tz=timezone.utc)

Note how JavaScript works in milliseconds while Python’s time.time() returns seconds — another reason to keep the units straight.

The year 2038 problem (briefly)

Systems that store timestamps as a signed 32-bit integer will overflow on 19 January 2038. Modern systems use 64-bit integers, which pushes the limit hundreds of billions of years out, so it’s rarely a concern today — but it’s worth knowing why 64-bit time exists.

Quick conversions

Need to check a timestamp right now? Paste it into the free Unix timestamp converter to see the local and UTC date instantly, convert a date back to a timestamp, or copy the current timestamp. It runs in your browser — no connection required.