Mysql query result time shows 8 hours difference

When php inserts data into Mysql, in order to ensure that different time zones have corresponding times, we will set the time of php to be

date_default_timezone_set('Asia/Shanghai');

At the same time, in order to ensure the time inserted into the database, it is also the Chinese time zone

Before executing the sql statement we will

set time_zone='+8:00'

After the data is inserted, after we select, it is found that there is a difference of 8 hours with the time we inserted

The data is correct, it's just that the time we inserted Mysql is displayed in the UTC time zone, which is 8 hours less than the Chinese time zone

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325019872&siteId=291194637