Unix Timestamp Cheat Sheet
A quick reference for Unix timestamps. Bookmark this page. You'll need it at 2 AM when you're staring at a 13-digit number in a log file.
Convert timestamps interactively with the Epoch Converter.
Common Timestamp Values
Timestamps you'll encounter in the wild. Useful for sanity checks and test data.
| Event | Timestamp (seconds) | Human Readable (UTC) |
|---|---|---|
| Unix Epoch | 0 | January 1, 1970 00:00:00 |
| First Moon Landing | -14182940 | July 20, 1969 20:17:40 |
| Y2K | 946684800 | January 1, 2000 00:00:00 |
| 1 Billion Seconds | 1000000000 | September 9, 2001 01:46:40 |
| iPhone Launch | 1183248000 | July 1, 2007 00:00:00 |
| 2020 Start | 1577836800 | January 1, 2020 00:00:00 |
| 2025 Start | 1735689600 | January 1, 2025 00:00:00 |
| 2026 Start | 1767225600 | January 1, 2026 00:00:00 |
| Y2038 Overflow | 2147483647 | January 19, 2038 03:14:07 |
| 2050 Start | 2524608000 | January 1, 2050 00:00:00 |
Year Boundaries (Start of Year, UTC)
| Year | Timestamp |
|---|---|
| 2020 | 1577836800 |
| 2021 | 1609459200 |
| 2022 | 1640995200 |
| 2023 | 1672531200 |
| 2024 | 1704067200 |
| 2025 | 1735689600 |
| 2026 | 1767225600 |
| 2027 | 1798761600 |
| 2028 | 1830297600 |
| 2029 | 1861920000 |
| 2030 | 1893456000 |
Format Comparison
The same moment in time expressed in different formats.
Reference moment: November 14, 2023, 22:13:20 UTC
| Format | Value |
|---|---|
| Unix (seconds) | 1700000000 |
| Unix (milliseconds) | 1700000000000 |
| Unix (microseconds) | 1700000000000000 |
| Unix (nanoseconds) | 1700000000000000000 |
| ISO 8601 | 2023-11-14T22:13:20Z |
| ISO 8601 with offset | 2023-11-14T22:13:20+00:00 |
| RFC 2822 | Tue, 14 Nov 2023 22:13:20 +0000 |
| RFC 3339 | 2023-11-14T22:13:20Z |
| HTTP Date | Tue, 14 Nov 2023 22:13:20 GMT |
| SQL (UTC) | 2023-11-14 22:13:20 |
Convert between formats with the Date Formatter.
Unit Conversion Table
| From | To Seconds | To Milliseconds | To Microseconds | To Nanoseconds |
|---|---|---|---|---|
| 1 second | 1 | 1,000 | 1,000,000 | 1,000,000,000 |
| 1 millisecond | 0.001 | 1 | 1,000 | 1,000,000 |
| 1 microsecond | 0.000001 | 0.001 | 1 | 1,000 |
| 1 nanosecond | 0.000000001 | 0.000001 | 0.001 | 1 |
Quick Conversion Rules
- Seconds to milliseconds: multiply by
1,000(add 3 zeros) - Seconds to microseconds: multiply by
1,000,000(add 6 zeros) - Seconds to nanoseconds: multiply by
1,000,000,000(add 9 zeros) - Milliseconds to seconds: divide by
1,000(remove 3 digits)
How to Identify the Format
| Digits | Unit | Example |
|---|---|---|
| 10 | Seconds | 1700000000 |
| 13 | Milliseconds | 1700000000000 |
| 16 | Microseconds | 1700000000000000 |
| 19 | Nanoseconds | 1700000000000000000 |
Quick Conversion One-Liners
Copy-paste snippets to get the current Unix timestamp.
Get Current Timestamp
| Language | Code | Returns |
|---|---|---|
| JavaScript | Math.floor(Date.now() / 1000) | Seconds |
| Python | int(time.time()) | Seconds |
| Java | Instant.now().getEpochSecond() | Seconds |
| Go | time.Now().Unix() | Seconds |
| Ruby | Time.now.to_i | Seconds |
| PHP | time() | Seconds |
| C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds() | Seconds |
| Rust | SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() | Seconds |
| Swift | Int(Date().timeIntervalSince1970) | Seconds |
| Bash | date +%s | Seconds |
Timestamp to Date String
| Language | Code |
|---|---|
| JavaScript | new Date(ts * 1000).toISOString() |
| Python | datetime.fromtimestamp(ts, tz=timezone.utc).isoformat() |
| Java | Instant.ofEpochSecond(ts).toString() |
| Go | time.Unix(ts, 0).UTC().Format(time.RFC3339) |
| Ruby | Time.at(ts).utc.iso8601 |
| PHP | gmdate('c', $ts) |
| C# | DateTimeOffset.FromUnixTimeSeconds(ts).ToString("o") |
| Bash (GNU) | date -d @1700000000 --utc |
| Bash (macOS) | date -r 1700000000 -u |
Date String to Timestamp
| Language | Code |
|---|---|
| JavaScript | Math.floor(new Date('2025-01-01T00:00:00Z').getTime() / 1000) |
| Python | int(datetime.fromisoformat('2025-01-01T00:00:00+00:00').timestamp()) |
| Java | Instant.parse("2025-01-01T00:00:00Z").getEpochSecond() |
| Go | t, _ := time.Parse(time.RFC3339, "2025-01-01T00:00:00Z"); t.Unix() |
| Ruby | Time.parse("2025-01-01T00:00:00Z").to_i |
| PHP | strtotime('2025-01-01T00:00:00Z') |
| C# | DateTimeOffset.Parse("2025-01-01T00:00:00Z").ToUnixTimeSeconds() |
| Bash (GNU) | date -d "2025-01-01T00:00:00Z" +%s |
Time Duration Reference
Useful constants for timestamp math.
| Duration | Seconds | Notes |
|---|---|---|
| 1 minute | 60 | |
| 5 minutes | 300 | |
| 15 minutes | 900 | |
| 30 minutes | 1,800 | |
| 1 hour | 3,600 | |
| 6 hours | 21,600 | |
| 12 hours | 43,200 | |
| 1 day | 86,400 | |
| 1 week | 604,800 | |
| 30 days | 2,592,000 | Not exactly 1 month |
| 365 days | 31,536,000 | Not exactly 1 year |
| 365.25 days | 31,557,600 | Average year accounting for leap years |
Warning: "1 month" and "1 year" do not have fixed second values. Months range from 28 to 31 days. Years are 365 or 366 days. For calendar arithmetic, use your language's datetime library instead of adding raw seconds.
Timezone Offset Quick Reference
Common timezone offsets from UTC. Remember: timestamps are always UTC. These offsets apply when displaying dates.
| Timezone | Abbreviation | UTC Offset | Major Cities |
|---|---|---|---|
| UTC | UTC | +00:00 | London (winter), Reykjavik |
| Central European | CET | +01:00 | Berlin, Paris, Amsterdam |
| Eastern European | EET | +02:00 | Helsinki, Athens, Cairo |
| India Standard | IST | +05:30 | Mumbai, Delhi, Bangalore |
| China Standard | CST | +08:00 | Beijing, Shanghai, Singapore |
| Japan Standard | JST | +09:00 | Tokyo, Seoul |
| Australian Eastern | AEST | +10:00 | Sydney, Melbourne |
| Eastern (US) | EST/EDT | -05:00 / -04:00 | New York, Toronto |
| Central (US) | CST/CDT | -06:00 / -05:00 | Chicago, Houston |
| Mountain (US) | MST/MDT | -07:00 / -06:00 | Denver, Phoenix |
| Pacific (US) | PST/PDT | -08:00 / -07:00 | Los Angeles, Seattle |
Note: Offsets marked with two values change with Daylight Saving Time. Always use named timezones (e.g., America/New_York) rather than fixed offsets in your code.
Convert between timezones with the TZ Converter.
Common Mistakes Quick Check
| Symptom | Likely Cause | Fix |
|---|---|---|
| Date shows January 1, 1970 | Timestamp is 0 / null / undefined | Check variable initialization |
| Date is in the year 55,000+ | Passed milliseconds where seconds expected | Divide by 1,000 |
| Date is 50 years too early | Passed seconds where milliseconds expected | Multiply by 1,000 |
| Time is off by a few hours | Timezone conversion issue | Use UTC consistently |
| Time is off by exactly 1 hour | DST not accounted for | Use named timezone, not fixed offset |
| Different results on different servers | Servers in different timezones | Set all servers to UTC |
For the full deep dive, read The Complete Guide to Unix Timestamps. To convert a timestamp right now, open the Epoch Converter.