TSUnix Timestamp
Convert between Unix timestamps and dates
Timestamp → Date
Date → Timestamp
Unix Timestamp Complete Guide
A Unix timestamp is an integer representing the number of seconds elapsed since January 1, 1970, 00:00:00 UTC (the Unix epoch). It is the standard format used by operating systems, databases, REST APIs, and logging systems to store and transmit date and time information. Its greatest advantage: one number unambiguously represents a single moment in time, regardless of timezone.
Seconds vs Milliseconds vs Microseconds
| Unit | Digits (2020s) | Example | Common Usage |
|---|---|---|---|
| Seconds | 10 digits | 1700000000 | Unix default, Python time.time() |
| Milliseconds | 13 digits | 1700000000000 | JavaScript Date.now(), Java |
| Microseconds | 16 digits | 1700000000000000 | Python time.time_ns()//1000 |
| Nanoseconds | 19 digits | 1700000000000000000 | Go time.Now().UnixNano() |
The Year 2038 Problem (Y2038)
Storing a Unix timestamp as a 32-bit signed integer maxes out at 2,147,483,647, which corresponds to January 19, 2038, 03:14:07 UTC. After that point, overflow causes the clock to wrap back to 1901.
- Affected systems: 32-bit C/C++ programs, legacy Linux kernels, some embedded devices
- Fix: Use 64-bit integers (~292 billion years of range)
- Modern systems: 64-bit OSes and languages are already safe. Python, Go, Rust, Java all use 64-bit timestamps.
- Watch out for: Legacy MySQL TIMESTAMP type (32-bit), some IoT devices
Timestamp Functions by Language
| Language | Current timestamp (seconds) | Milliseconds |
|---|---|---|
| JavaScript | Math.floor(Date.now()/1000) | Date.now() |
| Python | int(time.time()) | int(time.time()*1000) |
| Go | time.Now().Unix() | time.Now().UnixMilli() |
| Java | System.currentTimeMillis()/1000 | System.currentTimeMillis() |
| Rust | SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() | ...as_millis() |
FAQ
The Unix team chose it as a practical anchor during OS development in the late 1960s. There is no special mathematical significance — it was simply a convenient recent past date.
In the 2020s, a seconds timestamp is ~10 digits (~1.7 billion); milliseconds is ~13 digits (~1.7 trillion). This tool automatically distinguishes them using the 1e12 threshold.
Yes. A Unix timestamp is always an absolute UTC-based value. Timezone conversion only happens at display time.
Negative timestamps represent dates before the Unix epoch (before Jan 1, 1970). For example: -86400 is December 31, 1969.