Utilix knowledge base
What Is a Unix Timestamp?
Published May 1, 2026
A Unix timestamp (also called epoch time or POSIX time) is an integer that counts the number of seconds elapsed since 00:00:00 UTC on January 1, 1970 — a reference point chosen because it was a round number near the invention of Unix.
The Unix epoch is: 1970-01-01T00:00:00Z
Why developers use Unix timestamps
Time zone agnostic: A Unix timestamp is always in UTC. To display it in the user's local time, you convert at render time using their time zone. There is no ambiguity.
Simple arithmetic: Calculating the duration between two events is ts2 − ts1 seconds. Adding one day is +86400. There is no need for a calendar-aware library for basic operations.
Universal support: Every major programming language, database, and operating system natively handles Unix timestamps.
Compact storage: A 32-bit integer stores any date from 1901 to 2038. A 64-bit integer (now standard) handles hundreds of billions of years in either direction.
Seconds vs milliseconds
The original Unix timestamp is in seconds. Many modern APIs and languages use milliseconds instead:
| Context | Unit | Example value (approx. 2026-05-14) |
|---|---|---|
Unix time() in C / Python / shell | Seconds | 1,747,180,000 |
JavaScript Date.now() | Milliseconds | 1,747,180,000,000 |
Java System.currentTimeMillis() | Milliseconds | 1,747,180,000,000 |
| Snowflake IDs (Twitter/Discord) | Milliseconds (embedded) | encoded in ID |
Converting: Divide milliseconds by 1,000 to get seconds; multiply seconds by 1,000 to get milliseconds. Mixing the two is a very common bug — a millisecond timestamp passed to a function expecting seconds produces a date in the year 57,000+.
The Year 2038 problem
A signed 32-bit Unix timestamp overflows on 2038-01-19 03:14:07 UTC — this is the "Year 2038 problem" (analogous to Y2K). At that moment, a 32-bit counter wraps to a large negative number, representing 1901.
Most modern systems use 64-bit timestamps, which extends the range to ±292 billion years. However, embedded systems, older databases, and legacy code using 32-bit integers may still be affected.
Reading and writing timestamps
Shell:
date +%s # current Unix timestamp in seconds
date -d @1747180000 # convert timestamp to human date (GNU date)
Python:
import time
now = int(time.time()) # seconds
from datetime import datetime, timezone
dt = datetime.fromtimestamp(now, tz=timezone.utc) # UTC datetime
JavaScript:
const nowMs = Date.now(); // milliseconds
const nowSec = Math.floor(nowMs / 1000); // seconds
const dt = new Date(nowMs); // Date object
SQL (PostgreSQL):
SELECT to_timestamp(1747180000); -- seconds → timestamptz
SELECT EXTRACT(EPOCH FROM NOW()); -- current time → seconds
Use the Unix Timestamp Converter to instantly convert between human-readable dates and epoch values in both seconds and milliseconds.