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:
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:
Modify date. timezone = to date. timezone = "Asia/Shanghai" in php. ini (or change to date. timezone = PRC)Remove the semicolon,Restart Apache.