How to convert a timestamp
- Paste the number into Timestamp → date. The unit is detected from the number of digits: 10 digits are seconds, 13 are milliseconds, 16 are microseconds and 19 are nanoseconds. Override it if your value is unusual.
- Read the date in UTC, in ISO 8601 format, in your selected time zone, and relative to now (“3 days ago”).
- To go the other way, pick a date and time on the right and choose the time zone it's in. The Unix timestamp in seconds and milliseconds appears below.
The clock at the top shows the current Unix time in seconds, updated every second.
What a Unix timestamp is
A Unix timestamp (epoch time, POSIX time) counts the seconds since 1 January 1970, 00:00:00 UTC, not counting leap seconds. It's the same number everywhere in the world at a given moment, which is why databases, log files and APIs use it: no time zones, no daylight-saving ambiguities.
| Language | Current timestamp |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) (Date.now() is in milliseconds) |
| Python | int(time.time()) |
| PHP | time() |
| Java | Instant.now().getEpochSecond() |
| MySQL | UNIX_TIMESTAMP() |
| PostgreSQL | extract(epoch from now()) |
| Shell | date +%s |
Common pitfalls
- Seconds vs. milliseconds: JavaScript and Java use milliseconds, most Unix tools and PHP use seconds. If a date shows up in 1970 or in the year 50,000, you've mixed them up.
- Time zones: the timestamp itself has no time zone. Only when you display it as a date do you choose one. When converting a date to a timestamp, make sure the selected time zone is the one the date was written in.
- The year 2038 problem: systems that store timestamps as signed 32-bit integers overflow on 19 January 2038 at 03:14:07 UTC (2,147,483,647). Use 64-bit integers.
- Negative timestamps are dates before 1970 and are valid; this converter supports them.
Frequently asked questions
How do I know if my timestamp is in seconds or milliseconds?
Count the digits. Current dates are 10 digits in seconds (e.g. 1700000000) and 13 digits in milliseconds (e.g. 1700000000000). Auto-detect uses this rule.
Do Unix timestamps include leap seconds?
No. Unix time assumes every day has exactly 86,400 seconds, so leap seconds are not counted. For almost all applications this doesn’t matter.
What time zone is a Unix timestamp in?
None — it’s an absolute moment counted from midnight UTC on 1 January 1970. The same timestamp shows as different local times in different time zones.
Is this converter accurate for dates far in the future or past?
It handles any date JavaScript supports, roughly 271,000 years either side of 1970. Time zone rules for dates far from today are best-effort, because governments change them.