Default time zone settings for PHP

Source: Internet
Author: User
PHP default time zone setting & lt; ahref = 'function. strtotime' & gt; function. strtotime & lt;/a & gt;]: Itisnotsafetorelyonthesystem 'stimezoneset=. pleaseusethedate. t PHP default time zone settings

Function. strtotime]: It is not safe to rely on the system's timezone settings. please use the date. timezone setting, the TZ environment variable 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

?

Since the time taken by PHP is Greenwich mean time, it may be different from the local time. The Greenwich Mean Time and Beijing time are about eight hours different. solution:

1. add date_default_timezone_set () in the header of the application file to set the default time zone to Beijing time, that is:

Date_default_timezone_set ("PRC ");
?

2. Another way is to change the date. timezone of the php. ini file and set it to date. timezone = PRC.

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.