
In order to show the local time of a zone, please use the following query:

"country_code","zone_name","abbreviation","gmt_offset","dst"

WHERE tz.time_start <= UNIX_TIMESTAMP(UTC_TIMESTAMP()) AND z.zone_name='America/Los_Angeles' SELECT z.country_code, z.zone_name, tz.abbreviation, tz.gmt_offset, tz.dst
#CODE ON TIME MYSQL HOW TO#
The example below showing how to query the time zone information using zone name America/Los_Angeles. This is important to get the correct GMT offset especially areas having Daylight Saving Time. The validity of a time zone depends on time_start field in the database. Mysql -u USERNAME -pPASSWORD timezonedb < timezonedb.sql Usage The data can directly load into your MySQL server using following command: The SQL package contains timezonedb.sql, a SQL queries file dumped out by mysqldump. LOAD DATA LOCAL INFILE 'zone.csv' INTO TABLE `zone` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' SQL Format `zone_id` INT(10) NOT NULL AUTO_INCREMENT, LOAD DATA LOCAL INFILE 'timezone.csv' INTO TABLE `timezone` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' LOAD DATA LOCAL INFILE 'country.csv' INTO TABLE `country` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' INDEX `idx_country_code` (`country_code`) These CSV data can easily load into your MySQL database.

"397","US","Pacific/Honolulu" Installation The data is comma-delimited text in UTF-8 encoding.įields: "country_code","country_name" "TV","Tuvalu" CSV package contains country.csv, timezone.csv, and zone.csv.
