Guide
What Is a Unix Timestamp? A Developer's Guide
Unix timestamps are everywhere — in logs, APIs, databases, and JWTs. This guide explains what they are, the gotchas to watch for, and how to convert them.
If you have ever seen a number like 1700000000 where you expected a date,
you have met a Unix timestamp. They are compact, unambiguous, and
easy to compare, which is why they show up all over software. You can paste any value
into the timestamp converter to see it as a real date as you read.
What is a Unix timestamp?
A Unix timestamp (also called epoch time or POSIX
time) is the number of seconds that have elapsed since
00:00:00 UTC on 1 January 1970 — a moment known as the
Unix epoch. So 0 is the epoch itself, 86400
is exactly one day later, and negative values represent dates before 1970.
Because a timestamp is just a count of seconds in UTC, it represents the same instant everywhere on Earth. There is no time zone baked into the number — the time zone only matters when you format it for a human to read.
Seconds vs. milliseconds
This is the single most common source of bugs. Unix timestamps are traditionally in seconds, but many platforms use milliseconds:
date +%s, most databases, and JWTs use seconds.-
JavaScript's
Date.now()andgetTime()use milliseconds.
A quick rule of thumb: a seconds timestamp for a current date is about 10 digits, while a milliseconds timestamp is about 13 digits. The converter auto-detects which one you pasted, but you can force the unit if you need to.
Tip: if a date lands in 1970 when you expected today, you probably fed milliseconds into something that expected seconds (or vice versa). Multiply or divide by 1000.
Time zones and UTC
The timestamp is in UTC; the displayed date is not. The same instant
1700000000 is 2023-11-14T22:13:20Z in UTC but
2023-11-15T07:13:20+09:00 in Tokyo. When you convert, always be clear about
which zone you are reading the result in — the converter shows UTC and your local zone
side by side, plus any zone you pick.
Converting in code
A few common one-liners, all assuming seconds:
| Language | Timestamp → date |
|---|---|
| JavaScript | new Date(ts * 1000) |
| Python | datetime.fromtimestamp(ts, tz=timezone.utc) |
| Go | time.Unix(ts, 0) |
| Shell | date -d @ts (GNU) / date -r ts (BSD/macOS) |
The year 2038 problem
Systems that store the timestamp in a signed 32-bit integer can only
count up to 2147483647, which is reached at
03:14:07 UTC on 19 January 2038. One second later the value overflows
and wraps to a negative number — back to 1901. Modern systems use 64-bit integers, which
push the limit hundreds of billions of years out, but legacy code and data formats can
still be affected.
Related: How to Convert a Unix Timestamp to a Date (and Back) — copy-paste conversion examples in JavaScript, Python, Linux, and SQL.