Milestone timestamps
| Moment | Timestamp | Date (UTC) |
|---|---|---|
| The epoch | 0 | Thu, 01 Jan 1970 00:00:00 UTC |
| 1 billion seconds | 1,000,000,000 | Sun, 09 Sep 2001 01:46:40 UTC |
| 1.5 billion seconds | 1,500,000,000 | Fri, 14 Jul 2017 02:40:00 UTC |
| 2 billion seconds | 2,000,000,000 | Wed, 18 May 2033 03:33:20 UTC |
| Largest signed 32-bit value | 2,147,483,647 | Tue, 19 Jan 2038 03:14:07 UTC |
Getting the current timestamp in code
| Language | Seconds since the epoch |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
| Python | int(time.time()) |
| PHP | time() |
| Java | Instant.now().getEpochSecond() |
| Go | time.Now().Unix() |
| PostgreSQL | extract(epoch from now()) |
| MySQL | UNIX_TIMESTAMP() |
| Shell | date +%s |
How the conversion works
A timestamp is a count of seconds from 00:00:00 UTC on January 1, 1970. To read it, divide by 86,400 to get whole days since the epoch, step that many days through the calendar, and turn the remainder into hours, minutes and seconds. Going the other way reverses the steps. Your local time is then the UTC time shifted by your time zone’s offset on that date.
Date (UTC) = January 1, 1970 + timestamp ÷ 86,400 days