partitioning of time zones
The world is divided into 24 time zones, each time zone has its own local time, the same time in the local time zone of 1-23 hours, such as the local time in London and Beijing local time difference of 8 hours. In the field of international radio communications, a uniform time is used, which is called Universal Coordinated Time (UTC), and UTC is the same as Greenwich Mean Time (GMT).
Time zone settings in PHP
Because PHP5 has rewritten the data () function. PHP defaults to the standard GMT (that is, the zero zone), so you must change the time zone setting for the PHP language to get the local current time.
There are two ways to change the time zone setting in the PHP language
(1) Modify the settings in the php.ini file to find [data]; date.timezone = option, remove the preceding quotation marks and modify to: Date.timezone = PRC (PRC is the Chinese People's Republic time zone), and then restart Apache.
(2) In the application, you need to add the following function before using the time-date function
Date_default_timezone_set (timezone);
Among them, the time-zones that can be used to set China's Beijing Times include PRC (Chinese name Republic), Asia/chongqing (Chongqing), Asia/shanghai (Shanghai) or Asia/urumqi (Urumqi)
List of legitimate time zones: http://www.php.net/manual/en/timezones.php
For example:
echo "UTC time:". Date ("Y-m-d h:i:s"). "
";d ate_default_timezone_set (" PRC "); echo" Beijing time: ". Date (" Y-m-d h:i:s ")."
"; echo" Current time zone: ". Date_default_timezone_get ()."
";
The result of the operation is:
UTC time: 2016-03-26 07:19:57
Beijing Time: 2016-03-26 15:19:57
Current time zone: PRC
The above describes the PHP system time zone settings, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.