I am trying to convert UTC time into the users local time, it works fine until I try to convert the time to +14:00 timezone, the result is always null, anyone has idea? Here is my code:
select CONVERT_TZ(now(), '+00:00', '+14:00')
I am trying to convert UTC time into the users local time, it works fine until I try to convert the time to +14:00 timezone, the result is always null, anyone has idea? Here is my code:
select CONVERT_TZ(now(), '+00:00', '+14:00')
This is a known bug in MySQL:
You can fix that, by using timezone name instead of offset. UTC +14:00 equals to Pacific/Kiritimati timezone. So if You modify query to:
SELECT CONVERT_TZ(NOW(), '+00:00', 'Pacific/Kiritimati')
or
SELECT CONVERT_TZ(NOW(), 'UTC', 'Pacific/Kiritimati')
then You'll get valid date, not NULL.
BUT there is one condition. Your MySQL engine needs timezones list. If above queries still returns NULL, it means You don't have timezones list loaded into Your MySQL engine.
Probably You'll have to run also this command:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Plese check this thread for more information, about loading timezones list: convert_tz returns null
Tested on MySQL 5.6.36.