& Nbsp; Beijing time is in Zone 8, which may be due to time zone issues. but it was okay before. after google found that php started from php5.1.0. date is added to ini. the timezone option is disabled by default: php function date (& quot; Y-n-dH-I-s & quot ;); the output time is 8 hours different from the local time. solution: Beijing time is East 8, maybe Beijing time is East 8, maybe it is time zone. but it was okay before. after google found that php started from php5.1.0. date is added to ini. timezone is disabled by default.
Problem:
Php function date ("Y-n-d H-I-s"); the output time is 8 hours different from the local time.
Solution
Beijing time is East 8, which may be due to time zone issues. but it was okay before. after google found that php started from php5.1.0. date is added to ini. the timezone option is disabled by default, that is, the displayed time (no matter what php command is used) is the Greenwich mean time, and our time (Beijing time) the difference is exactly 8 hours.
Set the time zone before calling the date () function.
Method 1:
Date_default_timezone_set ('prc ');
No return value. Now we can use the date function directly.
$ Time = date (Y. "year". m. "month". d. "day". G. "hour". I. "minute ");
Method 2:
In php. ini, modify date. timezone = to date. timezone = "Asia/Shanghai" (or change to date. timezone = PRC), remove the semicolon, and restart Apache.