What is Unix epoch time?
Unix epoch (or Unix time) counts the number of seconds that have elapsed since January 1, 1970 at 00:00:00 Coordinated Universal Time (UTC). It is the standard time representation in Unix and POSIX operating systems, and is used by virtually all programming languages and database systems.
Why is 1970 the starting point?
January 1, 1970 was chosen as the epoch when Unix was developed in the early 1970s at Bell Labs — it was a recent, convenient reference point. The choice was somewhat arbitrary; it had no special mathematical significance.
What is the Year 2038 problem?
On January 19, 2038, 32-bit signed integers used to store Unix timestamps will overflow (2³¹ - 1 = 2,147,483,647 seconds = January 19, 2038 03:14:07 UTC). Modern 64-bit systems are not affected, but legacy embedded systems and older databases may fail. 64-bit Unix time won't overflow until the year 292,277,026,596.
What's the difference between Unix timestamp and ISO 8601?
Unix timestamp is an integer (1746172800). ISO 8601 is a human-readable string format (2026-05-02T00:00:00Z). Unix timestamps are better for storage, arithmetic, and API parameters. ISO 8601 is better for human-readable logs, exports, and inter-system data exchange.
Does JavaScript use seconds or milliseconds?
JavaScript uses milliseconds. Date.now() returns milliseconds since epoch. To convert to seconds (for most Unix APIs): Math.floor(Date.now() / 1000). To convert a Unix second timestamp to a JS Date: new Date(timestamp * 1000).
How do I get the current Unix timestamp in different languages?
JavaScript: Math.floor(Date.now() / 1000). Python: import time; int(time.time()). PHP: time(). Ruby: Time.now.to_i. Java: System.currentTimeMillis() / 1000L. Go: time.Now().Unix(). SQL (PostgreSQL): EXTRACT(EPOCH FROM NOW()). SQL (MySQL): UNIX_TIMESTAMP().
What is the maximum Unix timestamp value?
On 64-bit systems (all modern computers and servers), the maximum Unix timestamp is 9,223,372,036,854,775,807 seconds — corresponding to the year 292,277,026,596. In practice, this is unlimited for any foreseeable use. Only legacy 32-bit systems face the 2038 overflow limit (2,147,483,647 = January 19, 2038).
How do I convert a Unix timestamp to a readable date?
Paste the Unix timestamp into this tool and it converts immediately. To tell it apart: 10-digit numbers are second-precision (e.g. 1746172800), 13-digit numbers are millisecond-precision (e.g. 1746172800000). The tool detects precision automatically and shows both UTC and your local timezone. To convert manually in JavaScript: new Date(1746172800 * 1000).toISOString() for seconds, or new Date(1746172800000).toISOString() for milliseconds.
What is the difference between epoch time in seconds and milliseconds?
A second-precision Unix timestamp (10 digits, e.g. 1746172800) counts seconds elapsed since 1970-01-01T00:00:00Z. A millisecond-precision timestamp (13 digits, e.g. 1746172800000) counts milliseconds — it is exactly 1000× larger. JavaScript's Date.now() and most modern APIs return milliseconds. C, Go, Rust, Python's time.time(), and most Unix/Linux tools use seconds. Check the digit count before converting: if you convert a millisecond timestamp as if it were seconds, you get a date in year 57,000+.
Why does my converted timestamp show the wrong date or time?
Three common causes: (1) Precision mismatch — the most frequent error. A 13-digit millisecond timestamp treated as seconds shows a year around 57,000. Divide by 1000 first, or switch the tool's precision mode to milliseconds. (2) Timezone confusion — Unix timestamps are always UTC. If you see a date that is off by your timezone offset (e.g. 8 hours), you are converting correctly but the display timezone is different from what you expected. (3) Negative timestamp — a timestamp of -86400 is December 31, 1969, not an error.
How do I fix a timestamp timezone mismatch in my application?
Always store and transmit timestamps as UTC Unix integers (seconds or milliseconds). Never store a local time or timezone-offset string in a database. Convert to local time only at the display layer using Intl.DateTimeFormat with the user's IANA timezone: new Intl.DateTimeFormat('en-US', { timeZone: 'America/New_York' }).format(new Date(ts * 1000)). This way the stored value is unambiguous regardless of where the server or user is located.
What Unix timestamp corresponds to January 1, 2026 at midnight UTC?
1735689600 seconds (1,735,689,600). To compute any date's timestamp: Math.floor(new Date('2026-01-01T00:00:00Z').getTime() / 1000) in JavaScript, or int(datetime(2026,1,1,tzinfo=timezone.utc).timestamp()) in Python 3. Use the reverse direction in this tool — enter the date and select UTC to get the timestamp instantly.
What is Unix time 0 and what date is it?
Unix time 0 is the epoch itself: January 1, 1970 at 00:00:00 UTC, also written as 1970-01-01T00:00:00Z in ISO 8601. All positive Unix timestamps count seconds after this moment; negative timestamps represent dates before 1970. Unix time 0 was an arbitrary choice made when POSIX/Unix was designed — it was a recent, convenient round date with no special mathematical significance.
What is the largest Unix timestamp before the Year 2038 overflow?
On 32-bit systems, the maximum signed 32-bit integer is 2,147,483,647 — which corresponds to January 19, 2038 at 03:14:07 UTC. At 2,147,483,648 seconds, 32-bit systems overflow to a negative number and typically reset to December 13, 1901. Modern 64-bit systems are not affected: the 64-bit signed maximum (9,223,372,036,854,775,807 seconds) would not overflow until the year 292,277,026,596.
How do I get the current Unix timestamp in JavaScript?
Math.floor(Date.now() / 1000) gives the current Unix timestamp in seconds. Date.now() returns milliseconds; dividing by 1000 converts to seconds; Math.floor removes the decimal. For millisecond precision: Date.now(). For a string in ISO 8601: new Date().toISOString(). For POSIX shell: date +%s. For Python: import time; int(time.time()).
How do I convert a Unix timestamp to ISO 8601 format?
In JavaScript: new Date(timestamp * 1000).toISOString() produces 2026-05-02T00:00:00.000Z for a second-precision timestamp, or new Date(tsMs).toISOString() for milliseconds. In Python: datetime.utcfromtimestamp(ts).isoformat() + 'Z'. The ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) is the most portable for inter-system data exchange and is readable by JSON parsers, databases, and humans equally.