Working With Negative Unix Timestamps Before 1970
Storing a user's 1965 birthdate inside an unsigned integer column or a MySQL TIMESTAMP field fails with an error or resets to January 1, 1970. Because the Unix epoch starts in 1970, any earlier moment must be written as a negative integer.
Examples of Negative Unix Timestamps
Negative Unix numbers count backward second by second from 1970-01-01 00:00:00 UTC:
| Negative Unix Seconds | UTC Date and Time |
|---|---|
-1 | 1969-12-31 23:59:59 UTC |
-86400 | 1969-12-31 00:00:00 UTC |
-631152000 | 1950-01-01 00:00:00 UTC |
-2147483648 | 1901-12-13 20:45:52 UTC (32-bit minimum) |
Where Negative Timestamps Fail
- Unsigned columns: Using
BIGINT UNSIGNEDrejects all negative numbers. - MySQL TIMESTAMP: Allows only 1970 to 2038. Use
DATEorDATETIMEfor birthdates instead. - Legacy Windows C libraries: Older 32-bit
_mktime32treats-1as an error code rather than December 31, 1969. - Older SQLite or PHP 32-bit builds: Truncate signed 32-bit dates before December 13, 1901.