If the PHPdate year is too large, the result will be incorrect. how can this problem be solved? Echo date ('Y-m-d H: I: S', 3356676867 );
Error result: 11:46:11
Correct: 18:14:27
How can I output such an answer.
Reply to discussion (solution)
? Exam: http://blog.csdn.net/fdipzone/article/details/39457681
$ Dt = new DateTime ('@ 3356676867'); echo $ dt-> format ('Y-m-d H: I: s'); // 2076-05-14 10:14:27
? Up ?? Yes? Set ??, So no ?.
$ Dt = new DateTime ('@ 3356676867'); $ tz = timezone_open ('Asia/Shanghai'); $ dt-> setTimezone ($ tz ); echo $ dt-> format ('Y-m-d H: I: s'); // 2076-05-14 18:14:27
Xu said it was correct. if you encounter any problems, please read the manual.
If necessary, you can compile a recursive function by yourself. when the time is greater than the upper limit of the date () function, minus the number of seconds in four years, the result is calculated within the effective range, then add the number of reduced 4 years.
I am very grateful to the two upstairs. I am a beginner and still have many questions.