PHPdate () function Warning: Itisnotsafetorelyonthesystem solution _ php instance

Source: Internet
Author: User
This article mainly introduces the PHPdate () function Warning: The Itisnotsafetorelyonthesystem solution is actually caused by incorrect time zone settings. This article provides two methods to solve this problem, if you need it, you can refer to the recent system email prompts and don't care about it at first. Later, I read the prompts. The following message is displayed:

The Code is as follows:


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 gett
Ing this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing 'for 'cst/8.0/no DST 'Instead in/data0/htdocs/rows on line 542


In general, the timezone is not set. In China, the green + 8 hours are used, so you need to set it.

First

Add the following statement to the page header:

The Code is as follows:


Date_default_timezone_set ("PRC ");


This method has the disadvantage that all pages must be added.

Second

In php. ini, find the date. timezone line and change the value to PRC, for example, date. timezone = PRC. If you do not have this line, simply add it. Restart the WEB server and PHP.

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.