CDT does not exist in MySQL Timezones
I have recently updated MySql with Timezone information, using information mentioned here http://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html
The problem I am facing is that even though the database now has information on a lot of TimeZones, CDT
is not one of them, and when I do a timezone conversion
using SELECT CONVERT_TZ(displaytime,'GMT','CDT');
it returns null
Other conversions work though like SELECT CONVERT_TZ(displaytime,'GMT','MET');
works well
I have checked that the timezone table does not contain information about CDT. But I am not sure how to fix it. Should I add this manually to the table? Should I use a different source to import timezone information?
You need to use time zone IDs that are valid IANA TZDB identifiers. For US Central Time, use 'America/Chicago'
.
You should avoid using 3-character abbreviations for time zones, as only a few are in the TZDB, and in general they can be ambiguous ( CST
is also China Standard Time, Cuba Standard Time, etc...)
Also, While UTC
and GMT
will work, the fully qualified form is Etc/UTC
. In practice, you can use any of these.
下一篇: CDT在MySQL时区中不存在