It is not safe to rely on the system's timezone settings
Source: Internet
Author: User
Writing PHPProgramSometimes the following warning occurs:
PHP warning: 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 D: \ phpweb \ news \ file. PHP on line 17. This is because the time taken by PHP is Greenwich mean time, so there will be a difference between the GMT Standard Time and the Beijing time by about eight hours. We can solve this problem as follows:
1. Use date_default_timezone_set () in the page header to set my default time zone to Beijing time, that is, <? PHP date_default_timezone_set ("PRC");?> You can.
2. in PHP. ini, set the value of date. timezone to PRC, set date. timezone to PRC, and cancel this line. CodeTo remove the semicolon.
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.