After php5, you have to set the time zone yourself, either modify the settings of the php.ini or modify it in your code.
Setting the time zone in php.ini
Date.timezone = PRC
Set the time zone in your code
1 date_default_timezone_set (' Asia/shanghai ');//' Asia/shanghai ' Asia/Shanghai
2 Date_default_timezone_set (' asia/chongqing ');//Where asia/chongqing ' is ' Asia/Chongqing '
3 Date_default_timezone_set (' PRC ');//Where PRC is the "People's Republic of China"
4i ni_set (' Date.timezone ', ' etc/gmt-8 ');
5 ini_set (' Date.timezone ', ' PRC ');
6 Ini_set (' Date.timezone ', ' Asia/shanghai ');
7 ini_set (' Date.timezone ', ' asia/chongqing ');
The above seven ways, any one can meet our needs.
When the system is initialized, add
ini_set (' Date.timezone ', ' Asia/shanghai '); or Date_default_timezone_set ("PRC"); will resolve the time zone difference 8
Hours of problems.
Source
Http://sjolzy.cn/php-set-the-time-zone-of-the-two-methods.html
Two ways to set the time zone in PHP