Click to get common time point timestamps (local timezone):
Quick offset calculation (from now):
Enter one timestamp per line (auto-detects seconds/milliseconds):
A Unix timestamp is the number of seconds (or milliseconds) elapsed since January 1, 1970 00:00:00 UTC (Coordinated Universal Time) to a given moment. It is a cross-platform, cross-programming-language unified way to represent time, independent of any timezone. It is widely used in database storage, API communication, log recording, cache expiration, and more.
A second-level timestamp is a 10-digit number (e.g., 1700000000); a millisecond-level timestamp is a 13-digit number (e.g., 1700000000000). JavaScript's Date.now() returns milliseconds by default, while C's time() and PHP's time() return seconds.
The starting point of the Unix timestamp, 1970-01-01 00:00:00 UTC, is known as the Unix Epoch. This convention dates back to the early development of the Unix operating system (around 1969-1971). According to Unix pioneers Dennis Ritchie and Ken Thompson, 1970 was chosen as the starting point because it was a clean, rounded decade that made manual estimation convenient. Since then, Unix and its derivative systems (Linux, macOS, BSD, etc.) have all used this moment as the baseline for time calculation.
On 32-bit systems, Unix timestamps are typically stored as a 32-bit signed integer (int32_t), whose maximum value is 2147483647, corresponding to January 19, 2038 03:14:07 UTC. After this moment, the integer overflows and the timestamp becomes negative, causing systems to "roll back" time to 1901, leading to software failures. This is the famous Year 2038 problem (also called Y2K38).
The solution is to use 64-bit timestamps (int64_t, or time_t on 64-bit systems). A 64-bit timestamp can represent approximately 292 billion years, which is more than enough for any practical need. Modern 64-bit operating systems and most mainstream programming languages have migrated to 64-bit timestamps, though some embedded and legacy systems still need attention.
| Language | Seconds | Milliseconds |
|---|---|---|
| JavaScript | Math.floor(Date.now()/1000) | Date.now() |
| Python | int(time.time()) | int(time.time()*1000) |
| Java | Instant.now().getEpochSecond() | System.currentTimeMillis() |
| PHP | time() | intval(microtime(true)*1000) |
| Go | time.Now().Unix() | time.Now().UnixMilli() |
| C/C++ | time(NULL) | use clock_gettime |
| Ruby | Time.now.to_i | Time.now.to_i * 1000 |
| Swift | Int(Date().timeIntervalSince1970) | Int(Date().timeIntervalSince1970 * 1000) |
| SQL (MySQL) | UNIX_TIMESTAMP() | UNIX_TIMESTAMP(NOW(3))*1000 |
| Shell (Bash) | date +%s | date +%s%3N |
A Unix timestamp is the number of seconds (or milliseconds) that have elapsed since January 1, 1970 00:00:00 UTC (the Unix Epoch). It is a cross-platform, cross-language unified way to represent time, widely used in database storage, API communication, and log recording.
The Unix timestamp starts from January 1, 1970 00:00:00 UTC, known as the Unix Epoch. The maximum timestamp a 32-bit signed integer can represent is 2147483647, corresponding to January 19, 2038 03:14:07 UTC.
The Year 2038 problem refers to systems that store Unix timestamps as 32-bit signed integers, which will overflow after January 19, 2038 03:14:07 UTC, causing the time to roll back to 1901. The solution is to use 64-bit timestamps; modern 64-bit systems are unaffected.
A second-level timestamp is a 10-digit number (e.g., 1700000000), while a millisecond-level timestamp is a 13-digit number (e.g., 1700000000000). JavaScript's Date.now() returns milliseconds, while Linux's time() and PHP's time() return seconds. This tool auto-detects and supports both formats.
Unix timestamps themselves have no timezone concept; they are always based on UTC. The same timestamp has the same value anywhere in the world. Timezones only affect the display when converting a timestamp to a human-readable date and time. This tool supports UTC, local, and custom timezone switching.
In JavaScript, use Date.now() for a millisecond timestamp, and Math.floor(Date.now()/1000) for a second timestamp. You can also use new Date().getTime() or Date.parse(dateString) to get a timestamp for a specific time.