Home >Backend Development >PHP Tutorial >What to do if the Date acquisition time in PHP is incorrect_PHP Tutorial
Today, when I used echo $showtime=date("Y-m-d H:i:s") to obtain the system time, I found that the obtained time did not match the system time.
After some research, we found that the default time set by PHP is based on Greenwich Time Zone, so we must change PHP's time zone setting to Beijing time.
Operation method:
Open the php.ini file, usually in the PHP installation root directory
Find the;date.timezone
Delete the points in front of date.timezone number, and change it to date.timezone = PRC
Save and restart the Apahce service (sometimes there will be problems with Apache's restart function, it is recommended to stop first and then start)
Let's recheck echo $showtime= date("Y-m-d H:i:s").
Has time returned to normal?