Solution to the time difference in php8 hours _ PHP Tutorial

Source: Internet
Author: User
Tags what php
A summary of solutions to the time difference between php8 and hours. Php. date is added to ini. the timezone option is disabled by default, that is, the display time (no matter what php command is used) is the Greenwich Mean Time standard from php5.1.0, php. date is added to ini. timezone is disabled by default.

That is, the displayed time (no matter what php command is used) is the Greenwich Mean Time.

The difference between the time and our time (Beijing time) is exactly 8 hours. in the following three ways, we can restore the normal time.

1. the simplest method is not to use php5.1 or a later version.

2. if it must be used and php. ini cannot be modified
Add date_default_timezone_set (XXX );

3. once and for all, only php. ini can be modified. Open php. ini and find date. timezone. remove the semicolon.
= Add XXX to the backend and restart the http service (such as apache2 or iis ).


For XXX, the available values in mainland China are: Asia/Chongqing, Asia/Shanghai, Asia/Urumqi (Chongqing, Shanghai, and Urumqi in sequence)
Available in Hong Kong and Taiwan regions: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (in the order of Macao, Hong Kong, and Taipei)
Singapore: Asia/Singapore
Foreigners seem to have missed Beijing
Other available values are: Etc/GMT-8, Singapore, Hongkong, PRC
What is PRC? PRC is the People's Republic of China -_-
The above are all my documents from the php official documents to sort out the GMT-8 below the area, there may be omissions

That is, the display time (no matter what php command is used) is Greenwich mean time...

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.