Bug #14062 | Select convert_tz(now(),'EST','IST') returns null | ||
---|---|---|---|
Submitted: | 16 Oct 2005 22:59 | Modified: | 17 Oct 2005 9:38 |
Reporter: | Mahaveer Jain | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Query Browser | Severity: | S2 (Serious) |
Version: | 4.1.14 | OS: | Windows (Window XP) |
Assigned to: | CPU Architecture: | Any |
[16 Oct 2005 22:59]
Mahaveer Jain
[17 Oct 2005 9:38]
Valeriy Kravchuk
Thank you for a problem report. I've tried to repeat the problem you described on latest 4.1.16 build on Linux, after carefully performing the steps described in the manual (http://dev.mysql.com/doc/refman/4.1/en/time-zone-support.html). The result is the following: if you specify really existing time zone, by name, function works. If there is no such zone in the time_zone_tables, CONVERT_TZ returns you NULL (just as described in http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html): mysql> Select convert_tz(now(),'EST','GMT'); +-------------------------------+ | convert_tz(now(),'EST','GMT') | +-------------------------------+ | 2005-10-17 17:24:28 | +-------------------------------+ 1 row in set (0,00 sec) mysql> Select convert_tz(now(),'GMT','CST'); +-------------------------------+ | convert_tz(now(),'GMT','CST') | +-------------------------------+ | NULL | +-------------------------------+ 1 row in set (0,00 sec) mysql> Select convert_tz(now(),'GMT','CDT'); +-------------------------------+ | convert_tz(now(),'GMT','CDT') | +-------------------------------+ | NULL | +-------------------------------+ 1 row in set (0,00 sec) mysql> select * from time_zone_name where name like '%CDT%' or name like '%CST%' ; +-----------------------+--------------+ | Name | Time_zone_id | +-----------------------+--------------+ | CST6CDT | 313 | | SystemV/CST6 | 504 | | SystemV/CST6CDT | 505 | | posix/CST6CDT | 846 | | posix/SystemV/CST6 | 1037 | | posix/SystemV/CST6CDT | 1038 | | right/CST6CDT | 1380 | | right/SystemV/CST6 | 1571 | | right/SystemV/CST6CDT | 1572 | +-----------------------+--------------+ 9 rows in set (0,04 sec) mysql> select version(); +--------------+ | version() | +--------------+ | 4.1.16-debug | +--------------+ 1 row in set (0,00 sec) So, please, check your tables for the timezone names you are using. Also, you may try to download and install the appropriate tables from http://dev.mysql.com/downloads/timezones.html (although, they may be the same as yours). Looks like it is simply a problem of setting the right name for the timezone you need.
[17 Oct 2005 9:50]
Hartmut Holzgraefe
The timezone tables are only created but not populated by the install and upgrade scripts, you have to populate these yourself from your systems timezone data, see http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html
[24 Oct 2005 13:51]
Mahaveer Jain
The link doesn't work http://dev.mysql.com/downloads/timezones.html I am not sure the table I have are fine. mysql>select * from time_zone_name where name like '%CDT%' or name like '%CST%'; I get this result. Name Time_zone_id CST6CDT 324 SystemV/CST6 516 SystemV/CST6CDT 517 Also I want to know if I can use short hand form in convert_tz(), i.e, GMT, CST, CDT. I am using window and I cannot update the tables using my system table. So you check the link in the above URL.