Skip to main content

Unix Timestamp Converter — Epoch to Date and Back

Convert a Unix timestamp (epoch time) into a readable UTC date, or turn a date into a timestamp. Works with seconds and milliseconds, shows the current timestamp live and runs entirely in your browser.

POSIX ISO 8601 Client-Side Only

Features

  • Convert Unix timestamps to readable dates (UTC)
  • Convert dates back to Unix timestamps
  • Seconds and milliseconds supported
  • Current Unix timestamp, updated every second
  • Auto-convert while you type
  • Runs entirely in your browser, nothing is uploaded

What Is a Unix Timestamp?

A Unix timestamp (also called epoch time or POSIX time) counts the seconds that have passed since 1 January 1970, 00:00:00 UTC, the so-called Unix epoch. The timestamp 1700000000, for example, is 2023-11-14 22:13:20 UTC.

Because it is a single number without a time zone, a timestamp means the same moment everywhere in the world. That makes it the usual way to store and exchange points in time in databases, log files, APIs and JWT tokens (iat, exp). Only when a timestamp is displayed does it get converted to a local time.

Seconds or Milliseconds?

Not every system counts in seconds. The number of digits usually tells you which unit you have:

  • 10 digits, e.g. 1700000000: seconds. Used by Unix, PHP time(), Python time.time(), MySQL and JWT.
  • 13 digits, e.g. 1700000000000: milliseconds. Used by JavaScript Date.now(), Java System.currentTimeMillis() and many JSON APIs.

Choose the matching unit above the input. If you pick the wrong one, the result is off by a factor of 1000: 1700000000 read as milliseconds becomes 20 January 1970.

Getting the Current Timestamp in Code

The current Unix timestamp in seconds, in the languages you are most likely to need:

// JavaScript (Node.js, browser)
Math.floor(Date.now() / 1000)

# Python
import time
int(time.time())

// PHP
time();

# Bash / Linux / macOS
date +%s

-- MySQL
SELECT UNIX_TIMESTAMP();

-- PostgreSQL
SELECT EXTRACT(EPOCH FROM now())::bigint;

Common Pitfalls

  • Time zones: a timestamp is always UTC. This tool shows results in UTC and reads dates without a time zone as UTC. For local time add an offset, e.g. 2023-11-14T23:13:20+01:00.
  • Seconds vs. milliseconds: a date in 1970 or tens of thousands of years in the future almost always means the wrong unit.
  • The year 2038 problem: systems that store timestamps as signed 32-bit integers overflow after 2147483647, which is 19 January 2038, 03:14:07 UTC. Use 64-bit integers for new code.
  • Leap seconds: Unix time ignores them; every day has exactly 86,400 seconds. For everyday use this makes no difference.

Useful Resources

Wikipedia: Unix time Introduction to Unix time, its history and how it handles leap seconds
POSIX: Seconds Since the Epoch The official definition of Unix time in the POSIX standard (section 4)
MDN: Date.now() How JavaScript returns the current time in milliseconds
Wikipedia: Year 2038 problem Why 32-bit timestamps overflow in January 2038
RFC 3339: Date and Time on the Internet The date format based on ISO 8601 used by most APIs