Unix timestamps are everywhere — in databases, API responses, JWT tokens, log files, and system events. But a
number like 1772694478 is meaningless to humans. This guide explains what Unix timestamps are,
how they work, and how to convert epoch time to dates (and back) in every popular language.
What is a Unix Timestamp?
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since the Unix epoch: January 1, 1970, 00:00:00 UTC.
Unix Epoch: January 1, 1970 00:00:00 UTC = 0
Example: March 3, 2026 14:27:58 UTC = 1772694478
Calculation: 56 years × 365.25 days × 24h × 60m × 60s ≈ 1.77 billion secondsEpoch Concept
Unix timestamps are in seconds (10 digits). JavaScript's
Date.now() returns milliseconds (13 digits). If your timestamp has 13
digits, divide by 1000 before converting. Many APIs use milliseconds — always check the documentation.
Common Timestamp Formats
Format Example When Used
───────────────────────────────────────────────────────────
Unix (seconds) 1772694478 Databases, APIs, logs
Unix (milliseconds) 1772694478000 JavaScript, Java, AWS
ISO 8601 2026-03-03T14:27:58Z REST APIs, JSON
RFC 2822 Tue, 03 Mar 2026 14:27:58 +0000 Email headers
Human readable March 3, 2026 2:27 PM UI displayTimestamp Formats
Conversion Code Examples
JavaScript
// Timestamp → Date
const timestamp = 1772694478;
const date = new Date(timestamp * 1000); // JS uses milliseconds!
console.log(date.toISOString());
// "2026-03-03T14:27:58.000Z"
// Date → Timestamp
const now = Math.floor(Date.now() / 1000);
console.log(now); // current Unix timestamp
// Parse ISO string → Timestamp
const ts = Math.floor(new Date("2026-03-03T14:27:58Z").getTime() / 1000);
// 1772694478JavaScript
Python
from datetime import datetime, timezone
# Timestamp → Date
timestamp = 1772694478
dt = datetime.fromtimestamp(timestamp, tz=timezone.utc)
print(dt.isoformat()) # "2026-03-03T14:27:58+00:00"
# Date → Timestamp
now = int(datetime.now(timezone.utc).timestamp())
# Parse string → Timestamp
dt = datetime.fromisoformat("2026-03-03T14:27:58+00:00")
ts = int(dt.timestamp()) # 1772694478Python
C# / .NET
// Timestamp → DateTimeOffset
long timestamp = 1772694478;
var dto = DateTimeOffset.FromUnixTimeSeconds(timestamp);
Console.WriteLine(dto); // 3/3/2026 2:27:58 PM +00:00
// DateTimeOffset → Timestamp
long now = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
// Milliseconds
long ms = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();C#
SQL (PostgreSQL / MySQL)
-- PostgreSQL: Timestamp → Date
SELECT TO_TIMESTAMP(1772694478);
-- "2026-03-03 14:27:58+00"
-- PostgreSQL: Date → Timestamp
SELECT EXTRACT(EPOCH FROM NOW())::integer;
-- MySQL: Timestamp → Date
SELECT FROM_UNIXTIME(1772694478);
-- MySQL: Date → Timestamp
SELECT UNIX_TIMESTAMP(NOW());SQL
The Year 2038 Problem
32-bit systems store Unix timestamps as a signed 32-bit integer, which maxes out at 2,147,483,647 — corresponding to January 19, 2038 03:14:07 UTC. After this, the counter overflows. Modern 64-bit systems use 64-bit timestamps, which last until the year 292,277,026,596.
Unix timestamps are always in UTC. Never apply timezone offsets to the raw timestamp. Convert to local time only when displaying to users. Store dates as UTC timestamps or ISO 8601 strings in databases.
Try DateTime Converter
Convert between Unix timestamps, ISO 8601, and human-readable dates instantly. Free, no sign-up.
Open DateTime Converter →Conclusion
Unix timestamps are the universal language of time in computing. Whether you're debugging JWT expiration, querying databases, or parsing API responses, understanding epoch time is essential. Use Polymorpher's DateTime Converter for quick conversions, and check out our JWT Decoder guide for working with token expiration timestamps.