Unix Timestamp Explained: What It Is and How to Use It

What is a Unix Timestamp?

A Unix timestamp (also called Unix epoch time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. This reference point is called the Unix epoch.

Timestamps are timezone-independent — they represent the same instant worldwide. This makes them ideal for databases, APIs, logging, and any system that needs to store or compare dates without ambiguity.

// Current timestamp (July 12, 2026)
1783766400  // seconds since epoch

// What it represents:
// Jan 1, 1970 00:00:00 UTC  +  1783766400 seconds
// = July 12, 2026 00:00:00 UTC

Seconds vs Milliseconds

Most systems use seconds, but JavaScript uses milliseconds. This is the most common source of bugs when working with timestamps across languages.

Language/SystemUnitExample
JavaScriptMillisecondsDate.now()1783766400000
PythonSecondstime.time()1783766400.0
Unix/LinuxSecondsdate +%s1783766400
MySQLSecondsUNIX_TIMESTAMP()
PostgreSQLSecondsEXTRACT(EPOCH FROM NOW())
// JavaScript: seconds ↔ milliseconds
const nowSeconds = Math.floor(Date.now() / 1000);
const nowMillis = Date.now() * 1000;

// Python: convert to timestamp
import time
print(int(time.time()))  # 1783766400

Pitfall: If your JavaScript app receives a timestamp from a Python backend or Unix system, multiply by 1000 before using new Date(). Otherwise you'll get a date in 1970.

Usage Across Languages

// JavaScript: create Date from timestamp
const date = new Date(1783766400 * 1000); // seconds to ms
console.log(date.toISOString()); // "2026-07-12T00:00:00.000Z"

// Python: timestamp to date
from datetime import datetime
dt = datetime.fromtimestamp(1783766400)
print(dt.strftime('%Y-%m-%d %H:%M:%S'))  # 2026-07-12 00:00:00

// SQL: store and query with timestamps
INSERT INTO events (name, created_at)
VALUES ('signup', 1783766400);

SELECT * FROM events
WHERE created_at > 1783700000;

The Year 2038 Problem

Systems using 32-bit signed integers for Unix timestamps will overflow on January 19, 2038. The maximum 32-bit signed value is 2,147,483,647, which corresponds to 03:14:07 UTC on that date.

Most modern systems already use 64-bit integers, which won't overflow for approximately 292 billion years. However, legacy code, embedded systems, and some databases may still be affected.

Convert Unix timestamps to dates instantly?

Try Epoch Converter