PHP date year too big result is wrong how to solve?

Source: Internet
Author: User
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.


Reply to discussion (solution)

? Test: 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

? Now, up?? There is a place, so not?

$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 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

Thank you very much for upstairs two, I am a beginner, there are many do not understand

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.