PHP users are Linwei standard time, so with Beijing time related 8 hours, many friends in the use of PHP Date,time get time will find a difference of 8 hours, the following we look at the solution.
The simplest method is as follows
| The code is as follows |
Copy Code |
|
Date_default_timezone_set ("etc/gmt+8");//This is 8 hours slower than the Linwei standard time.
?> |
This solves the problem of 8 hours of jet lag.
How to set the Beijing time zone:
| The code is as follows |
Copy Code |
|
Date_default_timezone_set (' PRC '); Set China time zone
?> |
The function Ini_set () Sets the time zone:
Can be added at the beginning of the file
| The code is as follows |
Copy Code |
| Ini_set (' Date.timezone ', ' Asia/shanghai '); ' Asia/shanghai ' |
To Shanghai time zone
These are all described in the PHP program to set up, but some time the program is invalid, I came down to see how to operate in the php.ini
To manually modify php.ini settings
Open PHP to find
| The code is as follows |
Copy Code |
| Date.timezone = "PRC" |
If you have to remove the previous semicolon, no words manually added!
http://www.bkjia.com/PHPjc/629122.html www.bkjia.com true http://www.bkjia.com/PHPjc/629122.html techarticle PHP users are Linwei standard time, so with Beijing time related 8 hours, many friends in the use of PHP Date,time get time will find a difference of 8 hours, the following we see ...