This article introduces PHP date () and time () to obtain a solution that is inconsistent with the local time, the necessary reference solution
Add in the program
Use on page header
| The code is as follows |
Copy Code |
|
Date_default_timezone_set () Set my default time zone to GMT
Date_default_timezone_set (' PRC ');
echo Date (' y-m-d h:i:s ');
The first solution: |
Set the default time zone in the program.
| The code is as follows |
Copy Code |
|
Date_default_timezone_set (' PRC '); Set local time zone |
Second workaround:
Modify the php.ini to modify the "Date.timezone" entry to "Date.timezone = PRC"
The values available in mainland China are: asia/chongqing, Asia/shanghai, Asia/urumqi (Chongqing, Shanghai, Urumqi, respectively)
Taiwan available: Asia/macao, Asia/hong_kong, Asia/taipei (Macau, Hong Kong, Taipei, respectively)
and Singapore: Asia/singapore
Other available values are: Etc/gmt-8, Singapore, Hongkong, PRC
Note: PRC is the PRC
http://www.bkjia.com/PHPjc/628944.html www.bkjia.com true http://www.bkjia.com/PHPjc/628944.html techarticle This article describes the PHP date () and time () to obtain a solution that is inconsistent with the local time, the need for a reference to the solution in the program to join in the page header using the code as follows copy Generation ...