I stumble upon a mysql timestamp insert problem with the date value larger than current date
now the following step is
CREATE TABLE foo(
`ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`test_time`TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`ID`)
);
INSERT INTO foo(test_time) VALUES('2038-01-19 11:14:08'); // fail
INSERT INTO foo(test_time) VALUES('2038-01-19 11:14:07'); // ok
INSERT INTO foo(test_time) VALUES('2038-01-18 23:59:00'); // ok
INSERT INTO foo(test_time) VALUES('2039-01-01 00:00:00'); // fail
fail means the test_time value is 0000-00-00 00:00:00
my timezone is UTC+8
I want to know whether 2038-01-19 11:14:07 is the max timestamp of mysql support,what’s the meaningful moment of this time?
To store higher values for dates you must use
DATETIMEdatatype.TIMESTAMPhas a range from'1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTCDATETIMEhas a range from'1000-01-01 00:00:00' to '9999-12-31 23:59:59'http://dev.mysql.com/doc/refman/5.5/en/datetime.html
As suggested by @Joachim Isaksson: PHP & mySQL: Year 2038 Bug: What is it? How to solve it?