<?php
echo Date ("y-m-d h:i:s"); Current time
?>
This method obtains time and standard difference of 8 hours;
Starting with php5.1.0, PHP.ini added the Date.timezone option, which is closed by default
That is, the time that is displayed (no matter what PHP command is used) is Greenwich Standard Time
And our Time (Beijing time) is bad for just 8 hours, there are the following 3 methods can restore normal time.
1, the easiest way is not to use the php5.1 version
2, if you must use, and can not modify the php.ini, you need in the initialization of the statement of the time
Add Date_default_timezone_set (XXX) above;
CP does not have this problem
3, once and for all, only can modify php.ini. Open php.ini Find Date.timezone remove the preceding semicolon
= Add xxx back, restart HTTP service (such as Apache2 or IIS, etc.)
For XXX, the values available in mainland China are: Asia/shanghai
Taiwan available: Asia/macao, Asia/hong_kong, Asia/taipei (Macau, Hong Kong, Taipei)
and Singapore: Asia/singapore