PHP date year too big result is wrong how to solve?
This post was last edited by liyuan66 on 2015-03-24 17:31:03
echo Date (' y-m-d h:i:s ', 3356676867);
Error results: 1940-04-08 11:46:11
Correct for 2076/5/14 18:14:27
How can I output such an answer.
------to solve the idea----------------------
Yes, the stickers don't have a setting, so it's not right.
$dt = new DateTime ([email protected] ');
$tz = Timezone_open (' Asia/shanghai ');
$dt->settimezone ($tz);
echo $dt->format (' y-m-d h:i:s '); 2076-05-14 18:14:27
------to solve the idea----------------------
Xu Big said yes, encounter problems more Read the Handbook
If there is a need, you can write your own recursive function, when the time is greater than the date () function, minus the number of seconds of 4 years, into the valid range calculated results, and then how many 4 years to add back