Convert_tz returns null even after loading timezone tables

I have a MySQL database (hosted on Ubuntu) that has a table with a time zone. This date is in the UTC time zone. I have an application that uses this data, but you need to convert the time from UTC to PST in order to display the data in a useful format.

This can probably be changed at the application level, but I don’t have time for this, so I want to use convert_tzit to get the correct time zone until I have time to change the application to convert the time zone.

However, when I do something like

SELECT id, 
       category, 
       convert_tz(create_datetime, 'UTC', 'PST') as create_datetime
FROM table

I get a result like

1, category, NULL

I know that I need to load timezone tables, so I did by running this command:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

mysql. convert_tz NULL. - ?

!

+4
2

, create_datetime timestamp

, http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_convert-tz.

SELECT CONVERT_TZ ('2004-01-01 12:00:00', 'GMT', 'MET');

+1

, , . , MySQL, MET, 3- , PST. : "PST8PDT" . ,

select convert_tz('2016-10-16 06:23:00', 'UTC', 'PST');

NULL,

select convert_tz('2016-10-16 06:23:00', 'UTC', 'PST8PDT');

.

MySQL

select Name from mysql.time_zone_name;
+1

All Articles