Unix Timestamp Converter: Epoch to Human-Readable Date
Unix timestamps explained — what they are, how to convert them, and common debugging scenarios.
What is a Unix Timestamp?
A Unix timestamp (epoch time) is the number of seconds elapsed since January 1, 1970 00:00:00 UTC. It's the most common way to store dates in databases, APIs, and log files because it's timezone-independent and easy to compare.
1704067200 → 2024-01-01 00:00:00 UTC Seconds vs Milliseconds
Different systems use different precisions:
- Seconds — Unix/POSIX standard, used by most Unix systems and databases (
1704067200) - Milliseconds — JavaScript's
Date.now(), Java, many APIs (1704067200000) - Microseconds — PostgreSQL's
EXTRACT(EPOCH FROM ...), Python'stime.time()at high precision
Quick way to tell: if the number has 13 digits, it's milliseconds. 10 digits = seconds.
Convert Timestamps in Code
# JavaScript — current timestamp
Date.now() // milliseconds
Math.floor(Date.now() / 1000) // seconds
# JS — timestamp to date
new Date(1704067200 * 1000).toISOString()
// → "2024-01-01T00:00:00.000Z"
# Python
import datetime
datetime.datetime.fromtimestamp(1704067200, tz=datetime.UTC)
# SQL (PostgreSQL)
SELECT TO_TIMESTAMP(1704067200);
SELECT EXTRACT(EPOCH FROM NOW())::BIGINT;
# Bash
date -d @1704067200
date -r 1704067200 # macOS Common Timestamp Issues
- Y2K38 problem — 32-bit signed integers overflow on Jan 19, 2038. Use 64-bit integers.
- Timezone confusion — Unix timestamps are always UTC. Convert to local time only for display.
- Off by 1000 — mixing seconds and milliseconds is the most common bug. Check digit count.
- Daylight saving time — timestamps don't have DST issues since they're UTC-based.
JWT Expiry Debugging
JWT tokens use Unix timestamps for exp (expiration) and iat (issued at) claims. Paste the timestamp from your JWT into our converter to check if it's expired. Tip: use our JWT Decoder which converts these automatically.
Related Tools