[Maria-discuss] Time Zone help
All, I am facing some strange issue, I believe its due to my ignorant, would appreciate if you can help me out on this: DB Server system OS CentOS. I have loaded the timezone tables in mysql using: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql After loading, I have restrated the DB using systemctl restart mariadb: Then I have tried below in DB: select @@global.time_zone,@@system_time_zone; [image: Inline image 1] SELECT CONVERT_TZ( NOW(), @@global.time_zone , 'UTC' ), UTC_TIMESTAMP; [image: Inline image 3] SELECT CONVERT_TZ( NOW(), @@system_time_zone , 'UTC' ), UTC_TIMESTAMP; [image: Inline image 4] SELECT CONVERT_TZ( NOW(), 'EDT' , 'UTC' ), UTC_TIMESTAMP; [image: Inline image 2] For some reason, If I use named TZ in CONVERT_TZ function for FROM_TZ, its always showing NULL. Can anyone help me out what else i can do so I can pass the abbreviation or named TZ in FROM_TZ. Regards, Karthick
What does this return? SELECT * FROM time_zone_name WHERE `name` = 'EDT'; This is not present on my system on Red Hat Enterprise Linux Server release 6.8 (Santiago). You'll need to manually insert this data or get a updates TZ file I guess. Rhys From: Maria-discuss [mailto:maria-discuss-bounces+rhys.campbell=swisscom.com@lists.launchpad.net] On Behalf Of Karthick Subramanian Sent: 07 June 2017 11:09 To: Maria Discuss <maria-discuss@lists.launchpad.net> Subject: [Maria-discuss] Time Zone help All, I am facing some strange issue, I believe its due to my ignorant, would appreciate if you can help me out on this: DB Server system OS CentOS. I have loaded the timezone tables in mysql using: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql After loading, I have restrated the DB using systemctl restart mariadb: Then I have tried below in DB: select @@global.time_zone,@@system_time_zone; [Inline image 1] SELECT CONVERT_TZ( NOW(), @@global.time_zone , 'UTC' ), UTC_TIMESTAMP; [Inline image 3] SELECT CONVERT_TZ( NOW(), @@system_time_zone , 'UTC' ), UTC_TIMESTAMP; [Inline image 4] SELECT CONVERT_TZ( NOW(), 'EDT' , 'UTC' ), UTC_TIMESTAMP; [Inline image 2] For some reason, If I use named TZ in CONVERT_TZ function for FROM_TZ, its always showing NULL. Can anyone help me out what else i can do so I can pass the abbreviation or named TZ in FROM_TZ. Regards, Karthick
Hi Rhys, I found no records for the query you have shared. I tried to update tzdata using yum update tzdata and reload the time zones tables and restart the db server. Still no effect. I think this time_zone_name doesn't store day light abbreviation (Ex: EDT, CDT etc). But storing EST, CST etc. MariaDB [mysql]> select * from time_zone_name where length(name) = 3; +------+--------------+ | Name | Time_zone_id | +------+--------------+ | CET | 371 | | EET | 385 | | EST | 386 | | GMT | 490 | | HST | 495 | | MET | 515 | | MST | 516 | | PRC | 524 | | ROC | 571 | | ROK | 572 | | UCT | 575 | | UTC | 589 | | WET | 592 | +------+--------------+ Can anyone execute in your system and see you are successful: On Wed, Jun 7, 2017 at 4:19 PM, <Rhys.Campbell@swisscom.com> wrote:
What does this return?
SELECT * FROM time_zone_name WHERE `name` = 'EDT';
This is not present on my system on Red Hat Enterprise Linux Server release 6.8 (Santiago). You'll need to manually insert this data or get a updates TZ file I guess.
Rhys
*From:* Maria-discuss [mailto:maria-discuss-bounces+rhys.campbell= swisscom.com@lists.launchpad.net] *On Behalf Of *Karthick Subramanian *Sent:* 07 June 2017 11:09 *To:* Maria Discuss <maria-discuss@lists.launchpad.net> *Subject:* [Maria-discuss] Time Zone help
All,
I am facing some strange issue, I believe its due to my ignorant, would appreciate if you can help me out on this:
DB Server system OS CentOS.
I have loaded the timezone tables in mysql using:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
After loading, I have restrated the DB using systemctl restart mariadb:
Then I have tried below in DB:
select @@global.time_zone,@@system_time_zone;
[image: Inline image 1]
SELECT CONVERT_TZ( NOW(), @@global.time_zone , 'UTC' ), UTC_TIMESTAMP;
[image: Inline image 3]
SELECT CONVERT_TZ( NOW(), @@system_time_zone , 'UTC' ), UTC_TIMESTAMP;
[image: Inline image 4]
SELECT CONVERT_TZ( NOW(), 'EDT' , 'UTC' ), UTC_TIMESTAMP;
[image: Inline image 2]
For some reason, If I use named TZ in CONVERT_TZ function for FROM_TZ, its always showing NULL.
Can anyone help me out what else i can do so I can pass the abbreviation or named TZ in FROM_TZ.
Regards,
Karthick
participants (2)
-
Karthick Subramanian
-
Rhys.Campbell@swisscom.com