1. What is a Unix Timestamp?

A Unix timestamp (also called epoch time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC — a moment known as the Unix epoch. It is the universal way computers represent a single point in time as a simple integer.

Why 1970? The Unix operating system was developed at Bell Labs in the early 1970s. Its creators chose midnight on January 1, 1970 as the starting point (epoch) because it was close to the system's creation date and provided a convenient round number. The choice stuck, and today virtually every operating system, database, and programming language uses it.

The Y2038 Problem

Many older systems store timestamps as signed 32-bit integers. The maximum value of a signed 32-bit integer is 2,147,483,647, which corresponds to 03:14:07 UTC on January 19, 2038. After that moment, these systems will overflow and wrap around to a negative number — effectively jumping back to December 13, 1901.

This is known as the Year 2038 problem (Y2038). Modern 64-bit systems use 64-bit timestamps and are safe for billions of years, but legacy embedded systems, old databases, and some file formats may still be vulnerable. The fix: migrate to 64-bit time representations.

2. Seconds vs Milliseconds

Timestamps come in two common formats, and confusing them is a classic source of bugs:

  • Seconds — 10 digits (e.g., 1753056000). Used by Unix/Linux systems, Python, PHP, most databases, and the POSIX standard.
  • Milliseconds — 13 digits (e.g., 1753056000000). Used by JavaScript (Date.now()), Java (System.currentTimeMillis()), and many web APIs.

How to tell them apart: count the digits. If the number is around 10 digits long, it is in seconds. If it is around 13 digits, it is in milliseconds. A quick heuristic — if the value is greater than 10,000,000,000 (10 billion), it is almost certainly milliseconds.

// JavaScript — Date.now() returns milliseconds
const ms = Date.now();        // e.g. 1753056000000
const seconds = Math.floor(ms / 1000);  // e.g. 1753056000

// Python — time.time() returns seconds (as a float)
import time
ts = time.time()              # e.g. 1753056000.123

A common mistake is passing a millisecond timestamp to a function that expects seconds (or vice versa). This results in dates that are off by a factor of 1000 — either January 1970 or the year 51,395.

Quickly convert any timestamp with our free online tool:

Open Timestamp Converter →

3. Converting Timestamps

Here is how to convert Unix timestamps to human-readable dates in the most popular languages and tools:

JavaScript

// Timestamp (seconds) to Date
const ts = 1753056000;
const date = new Date(ts * 1000);  // multiply by 1000!
console.log(date.toISOString());   // "2025-07-21T00:00:00.000Z"

// Current timestamp
const now = Math.floor(Date.now() / 1000);  // seconds
const nowMs = Date.now();                    // milliseconds

Python

import datetime

# Timestamp (seconds) to datetime
ts = 1753056000
dt = datetime.datetime.fromtimestamp(ts, tz=datetime.timezone.utc)
print(dt)  # 2025-07-21 00:00:00+00:00

# Current timestamp
import time
now = int(time.time())

PHP

// Timestamp to formatted date
$ts = 1753056000;
echo date('Y-m-d H:i:s', $ts);  // 2025-07-21 00:00:00

// Current timestamp
$now = time();

Command Line (Linux/macOS)

# Convert timestamp to human-readable date
date -d @1753056000

# Current timestamp
date +%s

# macOS (BSD date uses a different syntax)
date -r 1753056000

4. Common Timestamp Values

Here is a quick reference table of well-known Unix timestamps:

Timestamp (seconds) UTC Date Note
0 1970-01-01 00:00:00 The Unix epoch (zero point)
1000000000 2001-09-09 01:46:40 One billion seconds milestone
1500000000 2017-07-14 02:40:00 One-and-a-half billion seconds
2000000000 2033-05-18 03:33:20 Two billion seconds milestone
2147483647 2038-01-19 03:14:07 Max 32-bit signed int (Y2038)

These milestone timestamps are useful for testing boundary conditions in your code and verifying that your system handles large values correctly.

5. Timezone Pitfalls

One of the most important things to understand about Unix timestamps: they are always in UTC. A Unix timestamp is an absolute, timezone-free number — it represents the same instant everywhere on Earth. Timezones only come into play when you convert a timestamp into a human-readable string.

UTC vs Local Time

When you convert a timestamp, most languages default to your system's local timezone. This can cause confusion if different servers or users are in different timezones:

# Python — two different results for the same timestamp!
import datetime

ts = 1753056000

# UTC — always correct and unambiguous
dt_utc = datetime.datetime.fromtimestamp(ts, tz=datetime.timezone.utc)
# 2025-07-21 00:00:00+00:00

# Local time — depends on where the code runs
dt_local = datetime.datetime.fromtimestamp(ts)
# 2025-07-21 08:00:00 (if server is UTC+8)

Best Practices

  • Store timestamps — Always store and transmit timestamps as UTC integers. Never store pre-formatted date strings with timezone offsets.
  • Display locally — Convert to local time only at the presentation layer (UI, reports, emails).
  • Use UTC in APIs — API responses should use ISO 8601 format with explicit UTC (Z suffix) or the timezone offset.
  • Never use local time for comparisons — Compare timestamps (integers), not formatted date strings.
// JavaScript — converting to local time safely
const ts = 1753056000;
const date = new Date(ts * 1000);

// UTC string (safe, unambiguous)
console.log(date.toISOString());    // "2025-07-21T00:00:00.000Z"

// Local string (depends on user's timezone)
console.log(date.toLocaleString()); // e.g. "7/21/2025, 8:00:00 AM"

6. Online Converter Tool

Instead of writing code to convert timestamps, use our free Timestamp Converter tool. It runs entirely in your browser — no data is sent to any server.

Features of the Timestamp Converter:

  • Timestamp to date — Paste any 10-digit or 13-digit timestamp and see the human-readable date instantly
  • Date to timestamp — Pick a date and time and get the corresponding Unix timestamp
  • Current timestamp — See the live current Unix timestamp updating in real time
  • Multi-format output — View results in ISO 8601, UTC, and your local timezone simultaneously
  • Copy with one click — Copy any converted value to your clipboard

The tool supports both seconds and milliseconds, automatically detecting the input format based on digit count. It works offline and respects your dark/light theme preference.

Convert timestamps instantly with our free tool:

Open Timestamp Converter →