echo Date ("y-m-d h:i:s"); Current time
?>
This method obtains the time and the standard difference 8 hours;
Starting with php5.1.0, PHP.ini added the Date.timezone option, which is turned off by default
That is, the time displayed (whatever PHP command is used) is Greenwich Mean Time
And our Time (Beijing time) The difference is exactly 8 hours, there are the following 3 methods can restore normal time.
1, the simplest way is not to use the version of php5.1 above
2, if must be used, and can not modify the php.ini, it is necessary in relation to the initialization of the time of the statement
Add Date_default_timezone_set (XXX) above;
CP does not have this problem
3, once and for all, can only modify php.ini. Open php.ini Find Date.timezone remove the preceding semicolon
= Add xxx After, restart HTTP service (such as Apache2 or IIS, etc.)
About XXX, mainland China The value available is: Asia/shanghai
Taiwan available: Asia/macao, Asia/hong_kong, Asia/taipei (Macau, Hong Kong, Taipei, respectively)
and Singapore: Asia/singapore
http://www.bkjia.com/PHPjc/478759.html www.bkjia.com true http://www.bkjia.com/PHPjc/478759.html techarticle ? PHP echo Date ("y-m-d h:i:s");//Current time? This method obtains the time and the standard difference 8 hours; from php5.1.0 onwards, PHP.ini added date.timezone this option, by default ...