When attempting to use the CONVERT_TZ() function to convert UTC timestamps to local time zones, you may encounter unexpected results. While the general syntax of the query you provided should work, it's important to verify a few aspects to ensure successful execution.
If the CONVERT_TZ() function is not working as expected, check if your database has initialized the timezone tables. Empty timezone tables can cause the function to behave erratically. To resolve this, run the mysql_tzinfo_to_sql program to load the necessary data.
The CONVERT_TZ() function is compatible with timestamp and date column types. Ensure that the displaytime column in your table is one of these types.
Double-check the timezone parameters you specified in the function. Make sure the 'GMT' and 'MET' values in your query are correct for the intended conversion.
A working example of the query with the correct parameters could look like this:
SELECT CONVERT_TZ(a_ad_display.displaytime, '+00:00', '+04:00');
For further guidance and documentation on time zone support in MySQL, refer to the following resources:
Das obige ist der detaillierte Inhalt vonWarum konvertiert meine CONVERT_TZ()-Funktion meine UTC-Zeitstempel nicht genau?. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!