Understanding "CONVERT_TZ Returns NULL" Error
In MySQL, encountering a "CONVERT_TZ Returns NULL" error can be frustrating, especially when it looks Seems so straight forward. The reason may be that the MySQL time zone table has not yet been loaded into the database.
To load the time zone table, use the following command:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
In this command:
After executing this command, the time zone table will be loaded in the database. You can now run the CONVERT_TZ function again and it will correctly return the converted time.
Note: the mysql_tzinfo_to_sql command may vary depending on your system. Consult the MySQL documentation for details on specific commands.
The above is the detailed content of Why Does CONVERT_TZ Return NULL in MySQL, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!