Unix Timestamps Cheatsheet
A quick reference for Unix epoch time — what it is, common conversions, date math, and language snippets for working with timestamps.
Try the Epoch / Unix ConverterSections
What Is a Unix Timestamp?
| Concept | Detail |
|---|---|
Definition | Number of seconds elapsed since 1970-01-01 00:00:00 UTC (the Unix epoch) |
Time zone | Always UTC — independent of local time zones |
Granularity | Seconds (Unix), milliseconds (JavaScript), microseconds (Python datetime), nanoseconds (Go) |
Signed 32-bit | Overflows on 2038-01-19 03:14:07 UTC (Year 2038 problem) |
Signed 64-bit | Safe for ~292 billion years — use this |
Common Reference Timestamps
| Unix Timestamp | Date / Time (UTC) |
|---|---|
0 | 1970-01-01 00:00:00 — the epoch |
86400 | 1970-01-02 00:00:00 — one day after epoch |
1000000000 | 2001-09-09 01:46:40 |
1234567890 | 2009-02-13 23:31:30 |
1700000000 | 2023-11-14 22:13:20 |
2147483647 | 2038-01-19 03:14:07 — max 32-bit signed int |
4102444800 | 2100-01-01 00:00:00 |
Time Unit Conversions
| Unit | Seconds |
|---|---|
1 minute | 60 |
1 hour | 3,600 |
1 day | 86,400 |
1 week | 604,800 |
30 days | 2,592,000 |
1 year (365 days) | 31,536,000 |
1 year (365.25 days) | 31,557,600 |
Language Snippets
| Language | Get Current Timestamp |
|---|---|
JavaScript | Date.now() // milliseconds Math.floor(Date.now() / 1000) // seconds |
Python | import time; int(time.time()) |
Go | time.Now().Unix() |
Bash | date +%s |
SQL (PostgreSQL) | EXTRACT(EPOCH FROM NOW())::BIGINT |
SQL (MySQL) | UNIX_TIMESTAMP() |
Ruby | Time.now.to_i |
PHP | time() |
Parse & Format Snippets
| Language | Parse Timestamp → Date |
|---|---|
JavaScript | new Date(ts * 1000).toISOString() |
Python | datetime.utcfromtimestamp(ts) |
Go | time.Unix(ts, 0).UTC() |
Bash | date -d @<ts> -u (GNU) / date -r <ts> -u (macOS) |
How to Convert an Epoch (Unix) Timestamp
A practical guide to Unix epoch timestamps — what they are, how to convert them to human-readable dates, and how to work with them in JavaScript, Python, and the command line.
Read guide →Working with Dates Across Time Zones in JavaScript
A practical guide to JavaScript dates — the Date object, UTC vs local time, formatting, parsing, and how to avoid the most common time zone bugs.
Read guide →