- [Date]
- ; Defines the default timezone used by the date functions
- ; Date. timezone =
It is disabled by default. you only need to remove the comment and change it
- [Date]
- ; Defines the default timezone used by the date functions
- Date. timezone = PRC
PRC is the People's Republic of China "! For other options, refer to the php Manual. The Asia region missed Beijing and MGB.
If you do not have the permission to modify php. ini, you only need to call date_default_timezone_set ('prc') when calling the time and date function! You can also call date_default_timezone_get () to view the current time zone settings!
For XXX, the available regions in large regions are: Asia/Chongqing, Asia/Shanghai, and Asia/Urumqi (which are re-built, Shanghai, and zookeeper in sequence) hong Kong and Taiwan region availability: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (in sequence: Macao, Hong Kong, and Taipei). The region can be set to date. timezone = "Asia // Taipei" and Singapore: Asia/Singapore
Appendix: Solution to eight hours of time difference in PHP5: php5.1.2 shows a total of eight hours,
- Echo date ("Y-m-d H: I: s ");
- ?>
The test result is 8 hours different.
In the original version of php5 and later versions, to export the local time (limited to China), you can refer to the following syntax:
- Date_default_timezone_set ('Asia/Shanghai ');
- Echo date ('Y-m-d H: I: s ');
- ?>
This is also possible:
- Date_default_timezone_set ('Asia/Chongqing ');
- Echo date ('Y-m-d H: I: s ');
- ?>
Let's see the wonderful result: the problem of time difference of eight hours has been solved successfully. |