–current epoch (seconds)
–milliseconds
What a Unix timestamp is
The number of seconds since 00:00:00 UTC on 1 January 1970, ignoring leap seconds. It is the same everywhere in the world at the same moment; only the displayed local time differs.
Seconds, milliseconds or more?
The converter decides by length: about 10 digits for current dates in seconds (Unix, Python time.time(), most APIs), 13 digits for milliseconds (JavaScript Date.now(), Java System.currentTimeMillis()), 16 for microseconds and 19 for nanoseconds (Go time.Now().UnixNano()).
Get the current timestamp in code
| Shell | date +%s |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
| Python | int(time.time()) |
| Go | time.Now().Unix() |
| PostgreSQL | extract(epoch from now()) |
| PowerShell | [DateTimeOffset]::UtcNow.ToUnixTimeSeconds() |
The year 2038 problem
Systems that store the timestamp as a signed 32-bit integer overflow after 2,147,483,647 seconds: 03:14:07 UTC on 19 January 2038. 64-bit timestamps don't have this limit.