Home >Backend Development >PHP Tutorial >PHP about time zone issues, PHP time zone issues_PHP tutorial
Recently, while learning PHP, I discovered that the formatted timestamp in PHP is 8 hours later than Beijing time. After searching online, I found that The time zone is wrong, the solution is:
1. Permanent modification Change data.timezone = PRC in the php.ini file This is China time. It will take effect after restarting the Apache service. 2. Temporary modification Added ini_set('date.timezone','Asia/Shanghai'); before using formatted input time. Or data_default_timezone_set('PRC');//date_default_timezone_set() function sets the default time zone used for all date/time functions in the script.