How Unix Timestamps Work — Epoch Time Explained for Developers
Updated May 5, 2026 · 9 min read
Written by Muhammad Abdullah Rauf · Founder, EverydayTools.pro
Quick answer: A Unix timestamp is the number of seconds since January 1, 1970 UTC. It is the universal, timezone-independent way to store and compare points in time in software.
Convert any timestamp instantly:
Free Unix Timestamp Converter →What is a Unix Timestamp?
A Unix timestamp (also called epoch time, POSIX time, or Unix time) is a single integer that represents a specific point in time as the number of seconds elapsed since the Unix epoch — 00:00:00 Coordinated Universal Time (UTC), Thursday, January 1, 1970.
For example, the Unix timestamp 1735689600 corresponds to January 1, 2025, 00:00:00 UTC. You can verify this with our Timestamp Converter.
Reference Timestamps
| Event | Unix Timestamp | ISO 8601 (UTC) |
|---|---|---|
| Unix epoch | 0 | 1970-01-01T00:00:00Z |
| Y2K (Jan 1, 2000) | 946,684,800 | 2000-01-01T00:00:00Z |
| Jan 1, 2020 | 1,577,836,800 | 2020-01-01T00:00:00Z |
| Jan 1, 2025 | 1,735,689,600 | 2025-01-01T00:00:00Z |
| Jan 1, 2026 | 1,767,225,600 | 2026-01-01T00:00:00Z |
| 2038 overflow point | 2,147,483,647 | 2038-01-19T03:14:07Z |
Why Developers Use Unix Timestamps
Timestamp Conversion Code
// Current Unix timestamp (seconds)
Math.floor(Date.now() / 1000) // → 1735689600
// Unix timestamp → Date
new Date(1735689600 * 1000).toISOString() // → '2025-01-01T00:00:00.000Z'
// Date string → Unix timestamp
Math.floor(new Date('2025-01-01').getTime() / 1000) // → 1735689600from datetime import datetime, timezone # Current Unix timestamp import time; int(time.time()) # → 1735689600 # Unix timestamp → datetime datetime.fromtimestamp(1735689600, tz=timezone.utc) # → datetime(2025, 1, 1, 0, 0, tzinfo=timezone.utc) # datetime → Unix timestamp int(datetime(2025, 1, 1, tzinfo=timezone.utc).timestamp()) # → 1735689600
-- Current timestamp SELECT EXTRACT(EPOCH FROM NOW())::INT; -- → 1735689600 -- Unix timestamp → timestamp SELECT TO_TIMESTAMP(1735689600); -- → 2025-01-01 00:00:00+00 -- timestamp → Unix SELECT EXTRACT(EPOCH FROM '2025-01-01'::timestamptz)::INT;
Common Pitfalls
⚠ Seconds vs milliseconds
Unix timestamps are in seconds. JavaScript's Date.now() and database DATETIME(3) fields use milliseconds. Always clarify the unit. Divide JS timestamps by 1000 before storing as Unix time.
⚠ Assuming local timezone
new Date(timestamp) in JavaScript uses the local timezone for display but the timestamp itself is UTC. Always use .toISOString() or Intl.DateTimeFormat with explicit timezone for display.
⚠ 32-bit overflow in 2038
Use 64-bit integer columns (BIGINT in SQL, int64 in Go, long in Java) for timestamps. MySQL TIMESTAMP type is 32-bit and will overflow in 2038 — use DATETIME instead.
⚠ Storing timestamps as strings
Storing '2025-01-01T00:00:00Z' as a VARCHAR loses sortability benefits and wastes space. Use BIGINT for Unix timestamps or database-native TIMESTAMP/DATETIME types.
Unix Time vs ISO 8601 vs RFC 2822
| Format | Example | Best for | Timezone? |
|---|---|---|---|
| Unix timestamp | 1735689600 | Storage, arithmetic, APIs | Always UTC |
| ISO 8601 | 2025-01-01T00:00:00Z | Human-readable, logging, APIs | Explicit (Z or ±HH:MM) |
| RFC 2822 | Wed, 01 Jan 2025 00:00:00 +0000 | HTTP headers, email | Explicit |
Frequently Asked Questions
What is a Unix timestamp?
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970 — known as the Unix epoch. It is a single integer that uniquely identifies any point in time, independent of time zones, locale, or calendar system.
Why January 1, 1970?
Unix was developed at Bell Labs in the late 1960s and early 1970s. The developers needed a fixed reference point for time calculations. January 1, 1970 was chosen as a round date near the beginning of Unix development — close enough to be practical without requiring negative numbers for recent dates.
What is the Unix Year 2038 problem?
32-bit signed integers can represent a maximum value of 2,147,483,647. Unix timestamp 2,147,483,647 corresponds to January 19, 2038 at 03:14:07 UTC. After that point, 32-bit signed systems will overflow to a large negative number, interpreting the date as 1901. Systems still using 32-bit timestamps (some embedded systems, legacy code) are vulnerable. Modern systems use 64-bit timestamps, which will be fine for the next ~292 billion years.
How do I convert a Unix timestamp to a human-readable date?
In JavaScript: new Date(timestamp * 1000).toISOString() (multiply by 1000 because JS uses milliseconds). In Python: datetime.fromtimestamp(timestamp, tz=timezone.utc). In SQL: FROM_UNIXTIME(timestamp) in MySQL, TO_TIMESTAMP(timestamp) in PostgreSQL. Or use our free Timestamp Converter tool to convert any timestamp instantly.
Does a Unix timestamp include time zone information?
No. A Unix timestamp is always UTC-based — it measures seconds since 1970-01-01 00:00:00 UTC. It has no concept of time zones. When you display a timestamp to a user, you apply the desired timezone offset at that point. This is one reason timestamps are preferred for storage — they are unambiguous.
What is the difference between Unix timestamp and JavaScript timestamp?
Unix timestamps count seconds since epoch. JavaScript's Date.now() counts milliseconds since epoch — 1000× larger. Always divide by 1000 when passing a JavaScript timestamp to systems expecting Unix seconds: Math.floor(Date.now() / 1000). Conversely, multiply by 1000 when using a Unix timestamp in new Date().