Home > Article > Backend Development > How to change time zone in php
How to modify the time zone in PHP?
How to modify the time zone in PHP:
Method 1:
Add the date.timezone item found in php.ini and set the date .timezone = "Asia/Shanghai", restart the environment and it will be ok.
Method 2:
Add the time zone ini_set('date.timezone','Asia/Shanghai'); in the header of the page;
Method 3:
When you need to use these time functions, add date_default_timezone_set("PRC");
Suitable for single problem solving
Related references:《PHP tutorial》
The above is the detailed content of How to change time zone in php. For more information, please follow other related articles on the PHP Chinese website!