What it does
A Unix timestamp counts the seconds since 00:00:00 UTC on 1 January 1970 (the "epoch"). Programs, databases and APIs use it because it is a single number that does not depend on time zones.
Units are detected automatically
- Up to 11 digits: seconds (for example
1516239022). - 12 to 14 digits: milliseconds, as used by JavaScript's
Date.now(). - 15 to 17 digits: microseconds. Longer values are treated as nanoseconds.
Date formats
Type dates as 2018-01-18, 2018-01-18 01:30:22 or full ISO 8601 such as 2018-01-18T01:30:22Z or 2018-01-18T06:30:22+05:00. When no time zone is written, the option you choose decides how the time is read.
Examples
1516239022is detected as seconds and is 2018-01-18T01:30:22.000Z in UTC.1700000000000has 13 digits, so it is detected as milliseconds: 2023-11-14T22:13:20.000Z.-86400is allowed too and gives 1969-12-31T00:00:00.000Z. Negative values are dates before 1970.- Going the other way,
2018-01-18T06:30:22+05:00is 1516239022 seconds, or 1516239022000 milliseconds, because +05:00 is five hours ahead of UTC.
Seconds or milliseconds? The most common mistake
A date in January 1970 almost always means a value in seconds was read as milliseconds: 1516239022 milliseconds is only about 17 days after the epoch. The opposite mistake gives a date tens of thousands of years in the future. This converter detects the unit from the number of digits, so check the “Detected as” line when a result looks strange.
Get the current Unix timestamp in your language
- JavaScript:
Math.floor(Date.now() / 1000) - Python:
int(time.time()) - PHP:
time() - Java:
Instant.now().getEpochSecond() - Go:
time.Now().Unix() - C#:
DateTimeOffset.UtcNow.ToUnixTimeSeconds() - Ruby:
Time.now.to_i - Bash:
date +%s - PostgreSQL:
EXTRACT(EPOCH FROM now()) - MySQL:
UNIX_TIMESTAMP()
The year 2038 problem
A signed 32-bit integer can hold at most 2147483647 seconds, which is 2038-01-19T03:14:07Z. Systems that still store timestamps in 32 bits will overflow after that moment. Timestamps stored in 64 bits, and the millisecond values used by JavaScript, are not affected.
Frequently asked questions
Does a Unix timestamp have a time zone?
No. It counts seconds since 1970-01-01 00:00:00 UTC, so the same number means the same instant everywhere. The time zone only matters when you display it as a date.
What time zone is used when I type a date without one?
The option under the date field decides: UTC or your local time. Add a zone such as Z or +05:00 to remove any doubt.
Are leap seconds counted?
No. Unix time ignores leap seconds, so each day has exactly 86400 seconds.
Is my input uploaded?
No. The converter runs in your browser.
Privacy
This tool runs entirely in your browser. What you enter is processed on your device and is not sent to a server.