? Phpechodate (Y-m-dH: I: s); current time? The difference between the time obtained by this method and the standard time is 8 hours. From php5.1.0, php. 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 difference between the Greenwich Mean Time and our time (Beijing time ).
? Php echo date (Y-m-d H: I: s); // current time? The difference between the time obtained by this method and the standard time is 8 hours. From php5.1.0, php. 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 difference between the Greenwich Mean Time and our time (Beijing time ).
Echo date ("Y-m-d H: I: s"); // current time
?>
The difference between the time obtained by this method and the standard time is 8 hours;
From php5.1.0, the date. timezone option is added to php. ini, Which is disabled by default.
That is, the displayed time (no matter what php Command is used) is the Greenwich Mean Time.
The difference between the time and our time (Beijing time) is exactly 8 hours. In the following three ways, we can restore the normal time.
1. The simplest method is not to use php5.1 or a later version.
2. If it must be used and php. ini cannot be modified
Add date_default_timezone_set (XXX );
Cp does not have this problem
3. Once and for all, only php. ini can be modified. Open php. ini and find date. timezone. Remove the semicolon.
= Add XXX to the backend and restart the http service (such as apache2 or iis ).
For XXX, the available value in mainland China is Asia/Shanghai.
Available in Hong Kong and Taiwan regions: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (in the order of Macao, Hong Kong, and Taipei)
Singapore: Asia/Singapore