Problem:
PHP function Date ("y-n-d h-i-s"); The output time differs from local time by 8 hours.
Solving ideas
Beijing time is East 8, it may be a time zone problem. But before the problem ah, after Google found that originally from php5.1.0, PHP.ini added date.timezone this option, by default is closed, That is, the time shown (no matter what PHP command) is Greenwich Standard Time, and our time (Beijing time) is bad 8 hours.
The time zone is set before the date () function is called.
Method One:
Date_default_timezone_set (' PRC ');
no return value. Let's just use the date function directly below OK
$time = Date (Y.) Year ". M." Month ". D." Day. " G. " When ". I." Points ");
Method Two:
Modify php.ini = Date.timezone = Date.timezone = "Asia/shanghai" (or change to Date.timezone = PRC) and remove the preceding semicolon, restart Apache.