Problem:
PHP function Date ("y-n-d h-i-s"); The output time differs from local time by 8 hours.
Solution Ideas
Beijing time is the East 8 district, may be the time zone question. But before all the problems ah, after Google found that the original from php5.1.0, PHP.ini added date.timezone this option, by default is closed, That is, the time displayed (no matter what PHP command) is Greenwich Mean time, and our time (Beijing time) is just 8 hours.
Set the time zone before calling the date () function.
Method One:
Date_default_timezone_set (' PRC ');
no return value. It's OK to use the DATE function directly below
$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 and restart Apache.
http://www.bkjia.com/PHPjc/320078.html www.bkjia.com true http://www.bkjia.com/PHPjc/320078.html techarticle Problem: php function Date ("y-n-d h-i-s"); the time of the output is 8 hours from the local time. The solution to the idea Beijing time is the East 8 district, may be the time zone problem. But it's OK, after go ...