Unix time is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, not counting leap seconds. That single integer is how most servers, databases, phones and log files store a moment. At midnight UTC on 1 January 2027, the count reaches 1,798,761,600. Because it is one plain number, comparing two dates is subtraction and sorting events is a numeric sort. The same value means the same instant in Hanoi, London and Los Angeles.
What is Unix time?
Unix time is a running count of seconds since the Unix epoch, 00:00:00 UTC on Thursday, 1 January 1970. According to Wikipedia's Unix time article, every day in this count is treated as exactly 86,400 seconds, and leap seconds are left out. Times before 1970 are negative numbers.
The word "epoch" means the fixed starting point of a time scale, which is why developers also say epoch time, POSIX time or a Unix timestamp. All four names describe the same number. The count is tied to Coordinated Universal Time (UTC), never to a local zone, so a server in Singapore and one in Virginia write the same value at the same instant.
Some quick reference points help you sanity-check a value:
- 0 is 1970-01-01 00:00:00 UTC.
- 86400 is exactly one day later, 1970-01-02 00:00:00 UTC.
- 1,798,761,600 is 2027-01-01 00:00:00 UTC.
Negative values are valid on systems that support them. Wikipedia gives 1 January 1969 as -31536000, exactly 365 days of 86,400 seconds before the epoch. Birth dates and historical records before 1970 depend on this, so a database column that only accepts positive integers cannot store them.
To watch the number tick upward second by second, open the live Unix clock.
Seconds, milliseconds and microseconds
A Unix timestamp in seconds has 10 digits for any date between September 2001 and November 2286. A 13-digit value is milliseconds and a 16-digit value is microseconds. Counting the digits is the fastest way to know which unit you have before you convert it.
The unit depends on the language. JavaScript's Date object stores time in milliseconds since the epoch, so Date.now() returns 13 digits. Unix shells, PHP's time() and most SQL functions return seconds. Python's time.time() returns seconds as a float with a fractional part.
Mixing units produces two classic bugs. Feed a 10-digit value to code that expects milliseconds and you get a date in mid-January 1970. Feed a 13-digit value to code that expects seconds and the year jumps past 50,000. If a converted date lands in either place, multiply or divide by 1,000. A quick rule of thumb: if the value is above 100,000,000,000, it is almost certainly milliseconds, because a seconds value that large would fall in the year 5138.
Unix time and leap seconds
Unix time ignores leap seconds: every day has exactly 86,400 seconds, even on the rare days when UTC adds a 61st second to its last minute. To stay in step, the Unix count repeats a value. Wikipedia's Unix time article notes that 1483228800 can mean either the leap second at the end of 2016 or the first second of 2017.
In practice this means Unix time is not a true count of elapsed SI seconds. Subtracting two timestamps that straddle a leap second gives an answer one second short. For logs, billing and scheduling, that gap does not matter.
Leap seconds are unrelated to leap days. A leap day adds 86,400 seconds to February in certain years, and Unix time counts that day like any other. The rules for those extra days are in the guide to leap years.
Notable Unix timestamps
Round Unix timestamps are easy to remember and handy for testing parsers. The best known are 1,000,000,000 in September 2001, the sequence 1,234,567,890 in February 2009, and 2,000,000,000 in May 2033. The table lists each one in UTC.
| Unix timestamp | Date and time (UTC) | Source |
|---|---|---|
| 0 | 1 January 1970, 00:00:00 | Wikipedia, Unix time |
| 1,000,000,000 | 9 September 2001, 01:46:40 | Wikipedia, Unix time |
| 1,234,567,890 | 13 February 2009, 23:31:30 | Wikipedia, Unix time |
| 1,798,761,600 | 1 January 2027, 00:00:00 | Python datetime |
| 2,000,000,000 | 18 May 2033, 03:33:20 | Python datetime |
| 2,147,483,647 | 19 January 2038, 03:14:07 | Wikipedia, Unix time |
| 9,999,999,999 | 20 November 2286, 17:46:39 | Python datetime |
The last row is where 10-digit second values end. One second later the count needs 11 digits.
The year 2038 problem
The year 2038 problem is the overflow of a signed 32-bit Unix time counter. Its largest value is 2,147,483,647 (2^31 - 1), reached at 03:14:07 UTC on 19 January 2038. One second later, a 32-bit counter wraps to a negative number and the date reads 20:45:52 UTC on 13 December 1901.
Most desktop and server operating systems already store time in a signed 64-bit integer. According to Wikipedia, that range stretches about 292 billion years in each direction from 1970, so the overflow is effectively gone there.
The risk sits in older code and small devices. Embedded controllers, file formats with 32-bit time fields and database columns typed as 32-bit integers can still fail. According to the MySQL reference manual, the TIMESTAMP column type has a range that ends at 2038-01-19 03:14:07 UTC. Any system that schedules events years ahead, such as a 15-year loan or a certificate that expires after 2038, can meet the limit well before the date itself.
How do I convert Unix time in code?
Convert Unix time by passing the number to your language's date function and stating the time zone you want. Check the unit first (seconds or milliseconds). Convert to UTC for storage and comparison, and apply a local zone only when you display the date to a person.
JavaScript works in milliseconds, so multiply seconds by 1,000:
new Date(1700000000 * 1000).toISOString() // "2023-11-14T22:13:20.000Z"
Math.floor(Date.now() / 1000) // current Unix time in seconds
Python returns local time unless you pass a zone, so give it UTC explicitly:
from datetime import datetime, timezone
datetime.fromtimestamp(1700000000, tz=timezone.utc) # 2023-11-14 22:13:20+00:00
int(datetime.now(timezone.utc).timestamp()) # current Unix time
PHP's date() follows the server's default zone, while gmdate() always uses UTC:
gmdate('Y-m-d H:i:s', 1700000000); // 2023-11-14 22:13:20
time(); // current Unix time
In SQL, MySQL uses FROM_UNIXTIME(1700000000) and UNIX_TIMESTAMP(), while PostgreSQL uses to_timestamp(1700000000) and EXTRACT(EPOCH FROM now()). FROM_UNIXTIME returns a value in the session time zone, so set the session to UTC if you need a fixed result.
When the result has to be read by people or other systems, store it as an ISO 8601 date string with a Z or an explicit offset. For one-off checks without writing code, paste the number into the Unix timestamp converter, which shows the date in UTC and in your own zone.











