Convert Unix timestamps to human-readable dates and back. Works in seconds and milliseconds.
Unix time (epoch time) counts seconds since January 1, 1970 00:00:00 UTC — the Unix epoch.
If the timestamp has 10 digits, it's in seconds. If 13 digits, it's in milliseconds. Divide ms by 1000 for seconds.
32-bit Unix timestamps overflow on January 19, 2038. 64-bit systems extend this to year 292 billion.
The standard date format for APIs: 2024-11-14T12:30:00Z. 'Z' means UTC (Zulu time).
Unix time (also called epoch time, POSIX time, or Unix timestamp) is a system for representing dates and times as a single number: the count of seconds that have elapsed since the Unix epoch — January 1, 1970, 00:00:00 UTC (Coordinated Universal Time). Unix time ignores leap seconds, making it a simple and consistent timekeeping method. It's the standard time representation in most operating systems, programming languages, and APIs. Current Unix time is always a positive integer and grows by exactly 1 per second.
In JavaScript: new Date(timestamp * 1000).toISOString() — note the ×1000 to convert seconds to milliseconds. In Python: datetime.fromtimestamp(timestamp) or datetime.utcfromtimestamp(timestamp) for UTC. In PHP: date('Y-m-d H:i:s', timestamp). In SQL: FROM_UNIXTIME(timestamp) in MySQL, or to_timestamp(timestamp) in PostgreSQL. Most modern programming languages have built-in functions for Unix timestamp conversion.
Unix timestamps can be expressed in seconds (most common in Unix/Linux systems and many APIs) or milliseconds (common in JavaScript and browser APIs). A 10-digit timestamp is typically in seconds: e.g., 1700000000 = November 14, 2023. A 13-digit timestamp is typically in milliseconds: 1700000000000 = the same moment. To convert ms to seconds: divide by 1000. JavaScript's Date.now() returns milliseconds. Python's time.time() returns seconds (with decimal for sub-second precision).
The Year 2038 Problem (Y2K38) affects systems that store Unix time as a signed 32-bit integer. A 32-bit signed integer can hold values up to 2,147,483,647 — which corresponds to January 19, 2038, 03:14:07 UTC. On this date, 32-bit systems will overflow (roll over to a very large negative number), potentially causing system failures. The fix is to use 64-bit integers for timestamps, which extend the range to year 292,277,026,596 — effectively infinite. Most modern 64-bit systems are already immune; older embedded systems and legacy software are at risk.
Current Unix timestamp by language: JavaScript: Math.floor(Date.now() / 1000) (seconds) or Date.now() (milliseconds). Python: import time; int(time.time()). PHP: time(). Java: System.currentTimeMillis() / 1000L. Ruby: Time.now.to_i. Go: time.Now().Unix(). C: time(NULL). SQL (MySQL): UNIX_TIMESTAMP(). SQL (PostgreSQL): EXTRACT(EPOCH FROM NOW()). Shell: date +%s. PowerShell: [int][double]::Parse((Get-Date -UFormat %s)).
Brite helps developers and everyone else plan their day, track habits, and stay productive — free.
Try Brite Free →