Unix Timestamp Reference
Notable timestamps, other epochs and how to get the time in code.
About Unix timestamp reference
Unix time counts the seconds since the Unix epoch, 00:00:00 UTC on 1 January 1970, ignoring leap seconds: every day is exactly 86,400 seconds. Because it's a single number that's the same everywhere at a given moment, it's the standard way to store and compare instants in databases, logs, file systems, JWT claims and APIs.
The year 2038 problem comes from storing Unix time in a signed 32-bit integer, which can count up to 2,147,483,647: 03:14:07 UTC on 19 January 2038. One second later the value wraps around to a negative number that reads as December 1901. Modern 64-bit operating systems, languages and databases use 64-bit time, but embedded devices, old file formats and database columns declared as 32-bit integers can still be affected.
Notable Unix timestamps
| Timestamp | Date and time (UTC) | Why it's notable |
|---|---|---|
| -2147483648 | 1901-12-13 20:45:52 UTC | Smallest signed 32-bit timestamp |
| 0 | 1970-01-01 00:00:00 UTC | The Unix epoch |
| 946684800 | 2000-01-01 00:00:00 UTC | Start of the year 2000 |
| 1000000000 | 2001-09-09 01:46:40 UTC | Unix time reached one billion |
| 1234567890 | 2009-02-13 23:31:30 UTC | The famous 1234567890 |
| 1500000000 | 2017-07-14 02:40:00 UTC | 1.5 billion seconds |
| 1600000000 | 2020-09-13 12:26:40 UTC | 1.6 billion seconds |
| 1700000000 | 2023-11-14 22:13:20 UTC | 1.7 billion seconds |
| 1800000000 | 2027-01-15 08:00:00 UTC | 1.8 billion seconds |
| 2000000000 | 2033-05-18 03:33:20 UTC | 2 billion seconds |
| 2147483647 | 2038-01-19 03:14:07 UTC | Largest signed 32-bit timestamp: the year 2038 problem |
| 4294967295 | 2106-02-07 06:28:15 UTC | Largest unsigned 32-bit timestamp |
Other epochs
Systems that count time from a different starting point, and how far it is from the Unix epoch.
| System | Epoch | Unit | Offset from Unix |
|---|---|---|---|
| Unix, POSIX, Linux, macOS | 1970-01-01 00:00:00 UTC | Seconds | 0 |
| JavaScript Date, Java | 1970-01-01 00:00:00 UTC | Milliseconds | 0 (× 1000) |
| Windows FILETIME, NTFS | 1601-01-01 00:00:00 UTC | 100-nanosecond intervals | 11644473600 s before Unix |
| .NET DateTime ticks | 0001-01-01 00:00:00 | 100-nanosecond intervals | 62135596800 s before Unix |
| NTP | 1900-01-01 00:00:00 UTC | Seconds | 2208988800 s before Unix |
| GPS time | 1980-01-06 00:00:00 UTC | Seconds (no leap seconds) | 315964800 s after Unix |
| Apple Cocoa, Core Data | 2001-01-01 00:00:00 UTC | Seconds | 978307200 s after Unix |
| Classic Mac OS, HFS+ | 1904-01-01 00:00:00 | Seconds | 2082844800 s before Unix |
| Excel (Windows default) | Serial day 1 = 1900-01-01 | Days | Day 25569 = 1970-01-01 |
Durations in seconds
| Span | Seconds |
|---|---|
| 1 minute | 60 |
| 1 hour | 3,600 |
| 1 day | 86,400 |
| 1 week | 604,800 |
| 30 days | 2,592,000 |
| 365 days | 31,536,000 |
| 366 days (leap year) | 31,622,400 |
| Average Gregorian year | 31,556,952 |
Current Unix time in code
| Language | Code |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
| Python | int(time.time()) |
| Bash | date +%s |
| Go | time.Now().Unix() |
| Java | Instant.now().getEpochSecond() |
| C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds() |
| PHP | time() |
| Ruby | Time.now.to_i |
| Rust | SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() |
| PostgreSQL | SELECT extract(epoch FROM now())::bigint; |
| MySQL | SELECT UNIX_TIMESTAMP(); |
| SQLite | SELECT unixepoch(); |
| Date from timestamp (GNU) | date -u -d @1700000000 |
| Date from timestamp (macOS, BSD) | date -u -r 1700000000 |
Good to know
Seconds or milliseconds?
A current timestamp in seconds has 10 digits; in milliseconds, 13. JavaScript (Date.now()) and Java (System.currentTimeMillis()) use milliseconds, most other languages and Unix tools use seconds. Mixing them up gives dates in January 1970 or thousands of years ahead.
More references
- HTTP status codesEvery HTTP status code and what it means
- MIME typesCommon MIME types by file extension
- ASCII tableAll 128 ASCII codes in dec, hex, octal and binary
- HTML entitiesNamed HTML entities with their codes
- Regex cheat sheetRegular expression syntax at a glance
- Cron examples30 common cron schedules explained
- Chmod examplesCommon Unix permissions like 644 and 755
- Git cheat sheetEveryday Git commands in one place
- Markdown cheat sheetMarkdown and GitHub Flavored syntax