I am trying to store in MySQL a date() field a successive date to the year 2037.
For example: 2065-12-01
Problem is that the field is returning: 1969-12-31
What is the correct way to record these values on DB? Should I use VARCHAR?
I compute the date field's value like this:
$future_date = date('Y-m-d', strtotime("+$number_years_to_add years"));
解决方案
It looks to me like you're using the php date and strtotime stuff on a 32-bit platform. Those functions turn into a pumpkin, like Cinderella's carriage, at 03:14:07 UTC on 19 January 2038.
You may wish to check out the new php DateTime class, or upgrade to a 64-bit php implementation.
(Thanks for catching this problem with 22 years of advance notice. Others will not.)