A Unix timestamp is the number of seconds since 1 January 1970 at 00:00:00 UTC. It's how databases, APIs, logs and JWTs store time, because it's just a number — no time zones, no formats. Here's how to get the current one in the languages you're most likely to use.

JavaScript / Node.js
Math.floor(Date.now() / 1000); // seconds
Date.now(); // milliseconds
Python
import time
int(time.time()) # seconds
time.time_ns() // 1_000_000 # milliseconds
PHP
time(); // seconds
(int) round(microtime(true) * 1000); // milliseconds
Java
Instant.now().getEpochSecond(); // seconds
System.currentTimeMillis(); // milliseconds
Go
time.Now().Unix() // seconds
time.Now().UnixMilli() // milliseconds
C#
DateTimeOffset.UtcNow.ToUnixTimeSeconds();
DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
Bash / Linux / macOS
date +%s
SQL
-- MySQL
SELECT UNIX_TIMESTAMP();
-- PostgreSQL
SELECT EXTRACT(EPOCH FROM NOW())::bigint;
-- SQLite
SELECT strftime('%s', 'now');

Seconds or milliseconds?
The most common timestamp bug is mixing the two. A quick check:
- 10 digits (e.g. 1790000000) — seconds. Used by Unix tools, PHP, Python, most APIs and JWT
expclaims. - 13 digits (e.g. 1790000000000) — milliseconds. Used by JavaScript and Java.
If a date shows up in January 1970, you probably passed seconds where milliseconds were expected. If it's tens of thousands of years in the future, it's the other way round.
Time zones don't apply
A Unix timestamp is always UTC. The same moment has the same timestamp in Tokyo and New York; only the display changes. Convert to local time at the last step, when you show it to a person.
The year 2038 problem
Systems that store timestamps as a signed 32-bit integer overflow on 19 January 2038. Modern languages and databases use 64-bit values, but old embedded devices and legacy database columns may still be affected.
Convert a timestamp to a date
- Open the free Timestamp Converter.
- Paste a Unix timestamp in seconds, or pick a date and time.
- See it as seconds, milliseconds, ISO 8601, UTC and your local time.
FAQ
Does a Unix timestamp include leap seconds? No. Unix time ignores leap seconds, so every day is exactly 86,400 seconds.
Can timestamps be negative? Yes — negative values are dates before 1970.
Try it now
Decode any timestamp with the free Timestamp Converter.
