Using the Date function in PHP51 or later versions is a warning solution

Source: Internet
Author: User
: This article mainly introduces how to handle warnings when using the Date function in PHP51 or later versions. if you are interested in the PHP Tutorial, refer to it. If you use the Date function in PHP5.1 or later versions, you will encounter the following Warning:

"PHP Warning: date () [function. date]: It is not safe to rely on the system's timezone settings. you are * required * to use the date. timezone setting or the date_default_timezone_set () function. in case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. we selected 'utc' for '8. 0/no DST 'Instead in"

This indicates that the time zone in PHP is not set or the function used is incorrect!

You can try to find PHP in the php installation file. ini (the file after configuration), and then Ctrl + F to find "date. timezone ", (the second file should be remembered), and the configuration file displays"; date. timez/span> "This statement needs to be modified. remove the previous one, and add PRC to the end of =. this means to enable the time zone function and set it to China (PRC) time zone!

Finally, you must restart the server (Apache, or IIS) and solve the problem !!!

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

The above section describes how to handle the warning when using the Date function in PHP51 or later versions, including some content. I hope my friends who are interested in the PHP Tutorial can help me.

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.