Epoch & Unix Timestamp Converter
Convert an epoch / Unix timestamp into a human readable date and vice-versa. Displays the current epoch time in seconds and milliseconds.
Current Unix epoch time
Convert epoch timestamp to date
Result
Convert date to epoch timestamp
Epoch and Unix timestamps explained
What is the Unix epoch?
The Unix epoch is the instant January 1, 1970 at 00:00:00 UTC. A Unix timestamp (also called epoch time, POSIX time or Unix time) is the number of seconds elapsed since that instant, not counting leap seconds. Because it is a single integer independent of time zones, calendars and locales, it is the most common way to store and exchange points in time between systems: file systems, databases, log files, JWT tokens (iat, exp), HTTP caches and most APIs use it. Negative values represent dates before 1970.
A few reference values: 0 = 1970-01-01T00:00:00Z, 86400 = one day later, 1000000000 = 2001-09-09T01:46:40Z, 1700000000 = 2023-11-14T22:13:20Z, 2147483647 = 2038-01-19T03:14:07Z (the 32-bit limit, see below).
Seconds, milliseconds, microseconds or nanoseconds?
The original Unix timestamp is in seconds, but many platforms use a finer resolution: JavaScript's Date.now(), Java's System.currentTimeMillis() and most JSON APIs return milliseconds (13 digits today), some databases and Python's time.time_ns() use microseconds (16 digits) or nanoseconds (19 digits). A timestamp in the wrong unit is off by a factor of 1,000 – a date in the year 55,000 is a sure sign that milliseconds were interpreted as seconds. The "Auto-detect" unit of this tool relies on the number of digits, which is unambiguous for present-day dates: 10 digits = seconds, 13 = milliseconds, 16 = microseconds, 19 = nanoseconds.
The year 2038 problem
Systems that store the timestamp as a signed 32-bit integer can only count up to 2,147,483,647 seconds, which corresponds to 2038-01-19 03:14:07 UTC. One second later the value overflows and wraps around to -2,147,483,648, i.e. December 13, 1901 – the "Y2K38" bug. Modern operating systems, languages and databases use 64-bit integers (good for another 292 billion years), but embedded devices, old file formats and legacy protocols may still be affected. Related limits: JavaScript Date objects cover ±100,000,000 days around the epoch (years −271821 to 275760), and MySQL TIMESTAMP columns stop at 2038-01-19 as well (use DATETIME instead).
Other things worth knowing
- Leap seconds are ignored: every Unix day has exactly 86,400 seconds, so the count is not strictly the number of SI seconds since 1970 (it currently differs by 27 seconds from TAI-based counts).
- The timestamp itself has no time zone; a time zone is only needed when you convert it to a calendar date for display. The same instant is
2026-08-29 12:00:00 UTC,08:00:00in New York and21:00:00in Tokyo. - ISO 8601 (
2026-08-29T12:00:00Z) is the recommended textual representation when a human-readable, sortable format is needed; RFC 2822 (Fri, 29 Aug 2026 12:00:00 GMT) is used by e-mail and HTTP headers. - Excel and LibreOffice count days since December 30, 1899 as decimal numbers: to convert an epoch to an Excel date divide by 86,400 and add 25,569.
How to get the current epoch time in…
| Language / tool | Seconds | Milliseconds |
|---|---|---|
| JavaScript / Node.js | Math.floor(Date.now() / 1000) | Date.now() |
| PHP | time() | (int) round(microtime(true) * 1000) |
| Python 3 | import time; int(time.time()) | time.time_ns() // 1_000_000 |
| Java | Instant.now().getEpochSecond() | System.currentTimeMillis() |
| C# / .NET | DateTimeOffset.UtcNow.ToUnixTimeSeconds() | DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() |
| Go | time.Now().Unix() | time.Now().UnixMilli() |
| Ruby | Time.now.to_i | (Time.now.to_f * 1000).to_i |
| MySQL / MariaDB | SELECT UNIX_TIMESTAMP(); | SELECT ROUND(UNIX_TIMESTAMP(NOW(3)) * 1000); |
| PostgreSQL | SELECT EXTRACT(EPOCH FROM NOW())::bigint; | SELECT (EXTRACT(EPOCH FROM NOW()) * 1000)::bigint; |
| SQL Server | SELECT DATEDIFF(SECOND, '1970-01-01', GETUTCDATE()); | SELECT DATEDIFF_BIG(MILLISECOND, '1970-01-01', GETUTCDATE()); |
| Bash / Linux shell | date +%s | date +%s%3N (GNU date) |
| Excel / Google Sheets | =(NOW() - DATE(1970,1,1)) * 86400 (local time) | =(NOW() - DATE(1970,1,1)) * 86400000 |
How to convert an epoch timestamp to a date in…
| Language / tool | Epoch seconds → date (UTC) |
|---|---|
| JavaScript / Node.js | new Date(epoch * 1000).toISOString() — for milliseconds: new Date(epochMs) |
| PHP | gmdate('Y-m-d H:i:s', $epoch) — or (new DateTimeImmutable('@' . $epoch))->setTimezone(new DateTimeZone('Europe/Paris')) |
| Python 3 | from datetime import datetime, timezone; datetime.fromtimestamp(epoch, tz=timezone.utc) |
| Java | Instant.ofEpochSecond(epoch) — or LocalDateTime.ofInstant(Instant.ofEpochSecond(epoch), ZoneOffset.UTC) |
| C# / .NET | DateTimeOffset.FromUnixTimeSeconds(epoch).UtcDateTime |
| Go | time.Unix(epoch, 0).UTC() |
| Ruby | Time.at(epoch).utc |
| MySQL / MariaDB | SELECT FROM_UNIXTIME(epoch); (session time zone) |
| PostgreSQL | SELECT to_timestamp(epoch); — or to_timestamp(epoch) AT TIME ZONE 'UTC' |
| SQL Server | SELECT DATEADD(SECOND, epoch, '1970-01-01'); (use DATEADD(MILLISECOND, …) with a bigint for milliseconds) |
| Bash / Linux shell | date -u -d @epoch (GNU) — date -u -r epoch (macOS / BSD) |
| Excel / Google Sheets | =epoch / 86400 + DATE(1970,1,1) then apply a date/time number format |