KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mysql > jdbc > TimeUtil


1 /*
2    Copyright (C) 2002 MySQL AB
3
4       This program is free software; you can redistribute it and/or modify
5       it under the terms of the GNU General Public License as published by
6       the Free Software Foundation; either version 2 of the License, or
7       (at your option) any later version.
8
9       This program is distributed in the hope that it will be useful,
10       but WITHOUT ANY WARRANTY; without even the implied warranty of
11       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12       GNU General Public License for more details.
13
14       You should have received a copy of the GNU General Public License
15       along with this program; if not, write to the Free Software
16       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18  */

19 package com.mysql.jdbc;
20
21 import java.sql.Time JavaDoc;
22 import java.sql.Timestamp JavaDoc;
23
24 import java.util.Calendar JavaDoc;
25 import java.util.Collections JavaDoc;
26 import java.util.HashMap JavaDoc;
27 import java.util.Map JavaDoc;
28 import java.util.TimeZone JavaDoc;
29
30
31 /**
32  * Timezone conversion routines
33  *
34  * @author Mark Matthews
35  */

36 public class TimeUtil {
37     static final TimeZone JavaDoc GMT_TIMEZONE = TimeZone.getTimeZone("GMT");
38     static final Map JavaDoc TIMEZONE_MAPPINGS;
39     static final Map JavaDoc ABBREVIATED_TIMEZONES;
40
41     static {
42         HashMap JavaDoc tempMap = new HashMap JavaDoc();
43
44         //
45
// Windows Mappings
46
//
47
tempMap.put("Romance", "Europe/Paris");
48         tempMap.put("Romance Standard Time", "Europe/Paris");
49         tempMap.put("Warsaw", "Europe/Warsaw");
50         tempMap.put("Central Europe", "Europe/Prague");
51         tempMap.put("Central Europe Standard Time", "Europe/Prague");
52         tempMap.put("Prague Bratislava", "Europe/Prague");
53         tempMap.put("W. Central Africa Standard Time", "Africa/Luanda");
54         tempMap.put("FLE", "Europe/Helsinki");
55         tempMap.put("FLE Standard Time", "Europe/Helsinki");
56         tempMap.put("GFT", "Europe/Athens");
57         tempMap.put("GFT Standard Time", "Europe/Athens");
58         tempMap.put("GTB", "Europe/Athens");
59         tempMap.put("GTB Standard Time", "Europe/Athens");
60         tempMap.put("Israel", "Asia/Jerusalem");
61         tempMap.put("Israel Standard Time", "Asia/Jerusalem");
62         tempMap.put("Arab", "Asia/Riyadh");
63         tempMap.put("Arab Standard Time", "Asia/Riyadh");
64         tempMap.put("Arabic Standard Time", "Asia/Baghdad");
65         tempMap.put("E. Africa", "Africa/Nairobi");
66         tempMap.put("E. Africa Standard Time", "Africa/Nairobi");
67         tempMap.put("Saudi Arabia", "Asia/Riyadh");
68         tempMap.put("Saudi Arabia Standard Time", "Asia/Riyadh");
69         tempMap.put("Iran", "Asia/Tehran");
70         tempMap.put("Iran Standard Time", "Asia/Tehran");
71         tempMap.put("Afghanistan", "Asia/Kabul");
72         tempMap.put("Afghanistan Standard Time", "Asia/Kabul");
73         tempMap.put("India", "Asia/Calcutta");
74         tempMap.put("India Standard Time", "Asia/Calcutta");
75         tempMap.put("Myanmar Standard Time", "Asia/Rangoon");
76         tempMap.put("Nepal Standard Time", "Asia/Katmandu");
77         tempMap.put("Sri Lanka", "Asia/Colombo");
78         tempMap.put("Sri Lanka Standard Time", "Asia/Colombo");
79         tempMap.put("Beijing", "Asia/Shanghai");
80         tempMap.put("China", "Asia/Shanghai");
81         tempMap.put("China Standard Time", "Asia/Shanghai");
82         tempMap.put("AUS Central", "Australia/Darwin");
83         tempMap.put("AUS Central Standard Time", "Australia/Darwin");
84         tempMap.put("Cen. Australia", "Australia/Adelaide");
85         tempMap.put("Cen. Australia Standard Time", "Australia/Adelaide");
86         tempMap.put("Vladivostok", "Asia/Vladivostok");
87         tempMap.put("Vladivostok Standard Time", "Asia/Vladivostok");
88         tempMap.put("West Pacific", "Pacific/Guam");
89         tempMap.put("West Pacific Standard Time", "Pacific/Guam");
90         tempMap.put("E. South America", "America/Sao_Paulo");
91         tempMap.put("E. South America Standard Time", "America/Sao_Paulo");
92         tempMap.put("Greenland Standard Time", "America/Godthab");
93         tempMap.put("Newfoundland", "America/St_Johns");
94         tempMap.put("Newfoundland Standard Time", "America/St_Johns");
95         tempMap.put("Pacific SA", "America/Caracas");
96         tempMap.put("Pacific SA Standard Time", "America/Caracas");
97         tempMap.put("SA Western", "America/Caracas");
98         tempMap.put("SA Western Standard Time", "America/Caracas");
99         tempMap.put("SA Pacific", "America/Bogota");
100         tempMap.put("SA Pacific Standard Time", "America/Bogota");
101         tempMap.put("US Eastern", "America/Indianapolis");
102         tempMap.put("US Eastern Standard Time", "America/Indianapolis");
103         tempMap.put("Central America Standard Time", "America/Regina");
104         tempMap.put("Mexico", "America/Mexico_City");
105         tempMap.put("Mexico Standard Time", "America/Mexico_City");
106         tempMap.put("Canada Central", "America/Regina");
107         tempMap.put("Canada Central Standard Time", "America/Regina");
108         tempMap.put("US Mountain", "America/Phoenix");
109         tempMap.put("US Mountain Standard Time", "America/Phoenix");
110         tempMap.put("GMT", "Europe/London");
111         tempMap.put("GMT Standard Time", "Europe/London");
112         tempMap.put("Ekaterinburg", "Asia/Yekaterinburg");
113         tempMap.put("Ekaterinburg Standard Time", "Asia/Yekaterinburg");
114         tempMap.put("West Asia", "Asia/Karachi");
115         tempMap.put("West Asia Standard Time", "Asia/Karachi");
116         tempMap.put("Central Asia", "Asia/Dhaka");
117         tempMap.put("Central Asia Standard Time", "Asia/Dhaka");
118         tempMap.put("N. Central Asia Standard Time", "Asia/Novosibirsk");
119         tempMap.put("Bangkok", "Asia/Bangkok");
120         tempMap.put("Bangkok Standard Time", "Asia/Bangkok");
121         tempMap.put("North Asia Standard Time", "Asia/Krasnoyarsk");
122         tempMap.put("SE Asia", "Asia/Bangkok");
123         tempMap.put("SE Asia Standard Time", "Asia/Bangkok");
124         tempMap.put("North Asia East Standard Time", "Asia/Ulaanbaatar");
125         tempMap.put("Singapore", "Asia/Singapore");
126         tempMap.put("Singapore Standard Time", "Asia/Singapore");
127         tempMap.put("Taipei", "Asia/Taipei");
128         tempMap.put("Taipei Standard Time", "Asia/Taipei");
129         tempMap.put("W. Australia", "Australia/Perth");
130         tempMap.put("W. Australia Standard Time", "Australia/Perth");
131         tempMap.put("Korea", "Asia/Seoul");
132         tempMap.put("Korea Standard Time", "Asia/Seoul");
133         tempMap.put("Tokyo", "Asia/Tokyo");
134         tempMap.put("Tokyo Standard Time", "Asia/Tokyo");
135         tempMap.put("Yakutsk", "Asia/Yakutsk");
136         tempMap.put("Yakutsk Standard Time", "Asia/Yakutsk");
137         tempMap.put("Central European", "Europe/Belgrade");
138         tempMap.put("Central European Standard Time", "Europe/Belgrade");
139         tempMap.put("W. Europe", "Europe/Berlin");
140         tempMap.put("W. Europe Standard Time", "Europe/Berlin");
141         tempMap.put("Tasmania", "Australia/Hobart");
142         tempMap.put("Tasmania Standard Time", "Australia/Hobart");
143         tempMap.put("AUS Eastern", "Australia/Sydney");
144         tempMap.put("AUS Eastern Standard Time", "Australia/Sydney");
145         tempMap.put("E. Australia", "Australia/Brisbane");
146         tempMap.put("E. Australia Standard Time", "Australia/Brisbane");
147         tempMap.put("Sydney Standard Time", "Australia/Sydney");
148         tempMap.put("Central Pacific", "Pacific/Guadalcanal");
149         tempMap.put("Central Pacific Standard Time", "Pacific/Guadalcanal");
150         tempMap.put("Dateline", "Pacific/Majuro");
151         tempMap.put("Dateline Standard Time", "Pacific/Majuro");
152         tempMap.put("Fiji", "Pacific/Fiji");
153         tempMap.put("Fiji Standard Time", "Pacific/Fiji");
154         tempMap.put("Samoa", "Pacific/Apia");
155         tempMap.put("Samoa Standard Time", "Pacific/Apia");
156         tempMap.put("Hawaiian", "Pacific/Honolulu");
157         tempMap.put("Hawaiian Standard Time", "Pacific/Honolulu");
158         tempMap.put("Alaskan", "America/Anchorage");
159         tempMap.put("Alaskan Standard Time", "America/Anchorage");
160         tempMap.put("Pacific", "America/Los_Angeles");
161         tempMap.put("Pacific Standard Time", "America/Los_Angeles");
162         tempMap.put("Mexico Standard Time 2", "America/Chihuahua");
163         tempMap.put("Mountain", "America/Denver");
164         tempMap.put("Mountain Standard Time", "America/Denver");
165         tempMap.put("Central", "America/Chicago");
166         tempMap.put("Central Standard Time", "America/Chicago");
167         tempMap.put("Eastern", "America/New_York");
168         tempMap.put("Eastern Standard Time", "America/New_York");
169         tempMap.put("E. Europe", "Europe/Bucharest");
170         tempMap.put("E. Europe Standard Time", "Europe/Bucharest");
171         tempMap.put("Egypt", "Africa/Cairo");
172         tempMap.put("Egypt Standard Time", "Africa/Cairo");
173         tempMap.put("South Africa", "Africa/Harare");
174         tempMap.put("South Africa Standard Time", "Africa/Harare");
175         tempMap.put("Atlantic", "America/Halifax");
176         tempMap.put("Atlantic Standard Time", "America/Halifax");
177         tempMap.put("SA Eastern", "America/Buenos_Aires");
178         tempMap.put("SA Eastern Standard Time", "America/Buenos_Aires");
179         tempMap.put("Mid-Atlantic", "Atlantic/South_Georgia");
180         tempMap.put("Mid-Atlantic Standard Time", "Atlantic/South_Georgia");
181         tempMap.put("Azores", "Atlantic/Azores");
182         tempMap.put("Azores Standard Time", "Atlantic/Azores");
183         tempMap.put("Cape Verde Standard Time", "Atlantic/Cape_Verde");
184         tempMap.put("Russian", "Europe/Moscow");
185         tempMap.put("Russian Standard Time", "Europe/Moscow");
186         tempMap.put("New Zealand", "Pacific/Auckland");
187         tempMap.put("New Zealand Standard Time", "Pacific/Auckland");
188         tempMap.put("Tonga Standard Time", "Pacific/Tongatapu");
189         tempMap.put("Arabian", "Asia/Muscat");
190         tempMap.put("Arabian Standard Time", "Asia/Muscat");
191         tempMap.put("Caucasus", "Asia/Tbilisi");
192         tempMap.put("Caucasus Standard Time", "Asia/Tbilisi");
193         tempMap.put("GMT Standard Time", "GMT");
194         tempMap.put("Greenwich", "GMT");
195         tempMap.put("Greenwich Standard Time", "GMT");
196         tempMap.put("UTC", "GMT");
197
198         TIMEZONE_MAPPINGS = Collections.unmodifiableMap(tempMap);
199
200         //
201
// Handle abbreviated mappings
202
//
203
tempMap = new HashMap JavaDoc();
204
205         tempMap.put("ACST", new String JavaDoc[] { "America/Porto_Acre" });
206         tempMap.put("ACT", new String JavaDoc[] { "America/Porto_Acre" });
207         tempMap.put("ADDT", new String JavaDoc[] { "America/Pangnirtung" });
208         tempMap.put("ADMT",
209             new String JavaDoc[] { "Africa/Asmera", "Africa/Addis_Ababa" });
210         tempMap.put("ADT",
211             new String JavaDoc[] {
212                 "Atlantic/Bermuda", "Asia/Baghdad", "America/Thule",
213                 "America/Goose_Bay", "America/Halifax", "America/Glace_Bay",
214                 "America/Pangnirtung", "America/Barbados", "America/Martinique"
215             });
216         tempMap.put("AFT", new String JavaDoc[] { "Asia/Kabul" });
217         tempMap.put("AHDT", new String JavaDoc[] { "America/Anchorage" });
218         tempMap.put("AHST", new String JavaDoc[] { "America/Anchorage" });
219         tempMap.put("AHWT", new String JavaDoc[] { "America/Anchorage" });
220         tempMap.put("AKDT",
221             new String JavaDoc[] {
222                 "America/Juneau", "America/Yakutat", "America/Anchorage",
223                 "America/Nome"
224             });
225         tempMap.put("AKST",
226             new String JavaDoc[] {
227                 "Asia/Aqtobe", "America/Juneau", "America/Yakutat",
228                 "America/Anchorage", "America/Nome"
229             });
230         tempMap.put("AKT", new String JavaDoc[] { "Asia/Aqtobe" });
231         tempMap.put("AKTST", new String JavaDoc[] { "Asia/Aqtobe" });
232         tempMap.put("AKWT",
233             new String JavaDoc[] {
234                 "America/Juneau", "America/Yakutat", "America/Anchorage",
235                 "America/Nome"
236             });
237         tempMap.put("ALMST", new String JavaDoc[] { "Asia/Almaty" });
238         tempMap.put("ALMT", new String JavaDoc[] { "Asia/Almaty" });
239         tempMap.put("AMST",
240             new String JavaDoc[] {
241                 "Asia/Yerevan", "America/Cuiaba", "America/Porto_Velho",
242                 "America/Boa_Vista", "America/Manaus"
243             });
244         tempMap.put("AMT",
245             new String JavaDoc[] {
246                 "Europe/Athens", "Europe/Amsterdam", "Asia/Yerevan",
247                 "Africa/Asmera", "America/Cuiaba", "America/Porto_Velho",
248                 "America/Boa_Vista", "America/Manaus", "America/Asuncion"
249             });
250         tempMap.put("ANAMT", new String JavaDoc[] { "Asia/Anadyr" });
251         tempMap.put("ANAST", new String JavaDoc[] { "Asia/Anadyr" });
252         tempMap.put("ANAT", new String JavaDoc[] { "Asia/Anadyr" });
253         tempMap.put("ANT", new String JavaDoc[] { "America/Aruba", "America/Curacao" });
254         tempMap.put("AQTST", new String JavaDoc[] { "Asia/Aqtobe", "Asia/Aqtau" });
255         tempMap.put("AQTT", new String JavaDoc[] { "Asia/Aqtobe", "Asia/Aqtau" });
256         tempMap.put("ARST",
257             new String JavaDoc[] {
258                 "Antarctica/Palmer", "America/Buenos_Aires", "America/Rosario",
259                 "America/Cordoba", "America/Jujuy", "America/Catamarca",
260                 "America/Mendoza"
261             });
262         tempMap.put("ART",
263             new String JavaDoc[] {
264                 "Antarctica/Palmer", "America/Buenos_Aires", "America/Rosario",
265                 "America/Cordoba", "America/Jujuy", "America/Catamarca",
266                 "America/Mendoza"
267             });
268         tempMap.put("ASHST", new String JavaDoc[] { "Asia/Ashkhabad" });
269         tempMap.put("ASHT", new String JavaDoc[] { "Asia/Ashkhabad" });
270         tempMap.put("AST",
271             new String JavaDoc[] {
272                 "Atlantic/Bermuda", "Asia/Bahrain", "Asia/Baghdad",
273                 "Asia/Kuwait", "Asia/Qatar", "Asia/Riyadh", "Asia/Aden",
274                 "America/Thule", "America/Goose_Bay", "America/Halifax",
275                 "America/Glace_Bay", "America/Pangnirtung", "America/Anguilla",
276                 "America/Antigua", "America/Barbados", "America/Dominica",
277                 "America/Santo_Domingo", "America/Grenada", "America/Guadeloupe",
278                 "America/Martinique", "America/Montserrat",
279                 "America/Puerto_Rico", "America/St_Kitts", "America/St_Lucia",
280                 "America/Miquelon", "America/St_Vincent", "America/Tortola",
281                 "America/St_Thomas", "America/Aruba", "America/Curacao",
282                 "America/Port_of_Spain"
283             });
284         tempMap.put("AWT", new String JavaDoc[] { "America/Puerto_Rico" });
285         tempMap.put("AZOST", new String JavaDoc[] { "Atlantic/Azores" });
286         tempMap.put("AZOT", new String JavaDoc[] { "Atlantic/Azores" });
287         tempMap.put("AZST", new String JavaDoc[] { "Asia/Baku" });
288         tempMap.put("AZT", new String JavaDoc[] { "Asia/Baku" });
289         tempMap.put("BAKST", new String JavaDoc[] { "Asia/Baku" });
290         tempMap.put("BAKT", new String JavaDoc[] { "Asia/Baku" });
291         tempMap.put("BDT",
292             new String JavaDoc[] { "Asia/Dacca", "America/Nome", "America/Adak" });
293         tempMap.put("BEAT",
294             new String JavaDoc[] { "Africa/Nairobi", "Africa/Mogadishu", "Africa/Kampala" });
295         tempMap.put("BEAUT",
296             new String JavaDoc[] {
297                 "Africa/Nairobi", "Africa/Dar_es_Salaam", "Africa/Kampala"
298             });
299         tempMap.put("BMT",
300             new String JavaDoc[] {
301                 "Europe/Brussels", "Europe/Chisinau", "Europe/Tiraspol",
302                 "Europe/Bucharest", "Europe/Zurich", "Asia/Baghdad",
303                 "Asia/Bangkok", "Africa/Banjul", "America/Barbados",
304                 "America/Bogota"
305             });
306         tempMap.put("BNT", new String JavaDoc[] { "Asia/Brunei" });
307         tempMap.put("BORT",
308             new String JavaDoc[] { "Asia/Ujung_Pandang", "Asia/Kuching" });
309         tempMap.put("BOST", new String JavaDoc[] { "America/La_Paz" });
310         tempMap.put("BOT", new String JavaDoc[] { "America/La_Paz" });
311         tempMap.put("BRST",
312             new String JavaDoc[] {
313                 "America/Belem", "America/Fortaleza", "America/Araguaina",
314                 "America/Maceio", "America/Sao_Paulo"
315             });
316         tempMap.put("BRT",
317             new String JavaDoc[] {
318                 "America/Belem", "America/Fortaleza", "America/Araguaina",
319                 "America/Maceio", "America/Sao_Paulo"
320             });
321         tempMap.put("BST",
322             new String JavaDoc[] {
323                 "Europe/London", "Europe/Belfast", "Europe/Dublin",
324                 "Europe/Gibraltar", "Pacific/Pago_Pago", "Pacific/Midway",
325                 "America/Nome", "America/Adak"
326             });
327         tempMap.put("BTT", new String JavaDoc[] { "Asia/Thimbu" });
328         tempMap.put("BURT",
329             new String JavaDoc[] { "Asia/Dacca", "Asia/Rangoon", "Asia/Calcutta" });
330         tempMap.put("BWT", new String JavaDoc[] { "America/Nome", "America/Adak" });
331         tempMap.put("CANT", new String JavaDoc[] { "Atlantic/Canary" });
332         tempMap.put("CAST",
333             new String JavaDoc[] { "Africa/Gaborone", "Africa/Khartoum" });
334         tempMap.put("CAT",
335             new String JavaDoc[] {
336                 "Africa/Gaborone", "Africa/Bujumbura", "Africa/Lubumbashi",
337                 "Africa/Blantyre", "Africa/Maputo", "Africa/Windhoek",
338                 "Africa/Kigali", "Africa/Khartoum", "Africa/Lusaka",
339                 "Africa/Harare", "America/Anchorage"
340             });
341         tempMap.put("CCT", new String JavaDoc[] { "Indian/Cocos" });
342         tempMap.put("CDDT", new String JavaDoc[] { "America/Rankin_Inlet" });
343         tempMap.put("CDT",
344             new String JavaDoc[] {
345                 "Asia/Harbin", "Asia/Shanghai", "Asia/Chungking", "Asia/Urumqi",
346                 "Asia/Kashgar", "Asia/Taipei", "Asia/Macao", "America/Chicago",
347                 "America/Indianapolis", "America/Indiana/Marengo",
348                 "America/Indiana/Knox", "America/Indiana/Vevay",
349                 "America/Louisville", "America/Menominee", "America/Rainy_River",
350                 "America/Winnipeg", "America/Pangnirtung", "America/Iqaluit",
351                 "America/Rankin_Inlet", "America/Cambridge_Bay",
352                 "America/Cancun", "America/Mexico_City", "America/Chihuahua",
353                 "America/Belize", "America/Costa_Rica", "America/Havana",
354                 "America/El_Salvador", "America/Guatemala",
355                 "America/Tegucigalpa", "America/Managua"
356             });
357         tempMap.put("CEST",
358             new String JavaDoc[] {
359                 "Europe/Tirane", "Europe/Andorra", "Europe/Vienna",
360                 "Europe/Minsk", "Europe/Brussels", "Europe/Sofia",
361                 "Europe/Prague", "Europe/Copenhagen", "Europe/Tallinn",
362                 "Europe/Berlin", "Europe/Gibraltar", "Europe/Athens",
363                 "Europe/Budapest", "Europe/Rome", "Europe/Riga", "Europe/Vaduz",
364                 "Europe/Vilnius", "Europe/Luxembourg", "Europe/Malta",
365                 "Europe/Chisinau", "Europe/Tiraspol", "Europe/Monaco",
366                 "Europe/Amsterdam", "Europe/Oslo", "Europe/Warsaw",
367                 "Europe/Lisbon", "Europe/Kaliningrad", "Europe/Madrid",
368                 "Europe/Stockholm", "Europe/Zurich", "Europe/Kiev",
369                 "Europe/Uzhgorod", "Europe/Zaporozhye", "Europe/Simferopol",
370                 "Europe/Belgrade", "Africa/Algiers", "Africa/Tripoli",
371                 "Africa/Tunis", "Africa/Ceuta"
372             });
373         tempMap.put("CET",
374             new String JavaDoc[] {
375                 "Europe/Tirane", "Europe/Andorra", "Europe/Vienna",
376                 "Europe/Minsk", "Europe/Brussels", "Europe/Sofia",
377                 "Europe/Prague", "Europe/Copenhagen", "Europe/Tallinn",
378                 "Europe/Berlin", "Europe/Gibraltar", "Europe/Athens",
379                 "Europe/Budapest", "Europe/Rome", "Europe/Riga", "Europe/Vaduz",
380                 "Europe/Vilnius", "Europe/Luxembourg", "Europe/Malta",
381                 "Europe/Chisinau", "Europe/Tiraspol", "Europe/Monaco",
382                 "Europe/Amsterdam", "Europe/Oslo", "Europe/Warsaw",
383                 "Europe/Lisbon", "Europe/Kaliningrad", "Europe/Madrid",
384                 "Europe/Stockholm", "Europe/Zurich", "Europe/Kiev",
385                 "Europe/Uzhgorod", "Europe/Zaporozhye", "Europe/Simferopol",
386                 "Europe/Belgrade", "Africa/Algiers", "Africa/Tripoli",
387                 "Africa/Casablanca", "Africa/Tunis", "Africa/Ceuta"
388             });
389         tempMap.put("CGST", new String JavaDoc[] { "America/Scoresbysund" });
390         tempMap.put("CGT", new String JavaDoc[] { "America/Scoresbysund" });
391         tempMap.put("CHDT", new String JavaDoc[] { "America/Belize" });
392         tempMap.put("CHUT", new String JavaDoc[] { "Asia/Chungking" });
393         tempMap.put("CJT", new String JavaDoc[] { "Asia/Tokyo" });
394         tempMap.put("CKHST", new String JavaDoc[] { "Pacific/Rarotonga" });
395         tempMap.put("CKT", new String JavaDoc[] { "Pacific/Rarotonga" });
396         tempMap.put("CLST",
397             new String JavaDoc[] { "Antarctica/Palmer", "America/Santiago" });
398         tempMap.put("CLT",
399             new String JavaDoc[] { "Antarctica/Palmer", "America/Santiago" });
400         tempMap.put("CMT",
401             new String JavaDoc[] {
402                 "Europe/Copenhagen", "Europe/Chisinau", "Europe/Tiraspol",
403                 "America/St_Lucia", "America/Buenos_Aires", "America/Rosario",
404                 "America/Cordoba", "America/Jujuy", "America/Catamarca",
405                 "America/Mendoza", "America/Caracas"
406             });
407         tempMap.put("COST", new String JavaDoc[] { "America/Bogota" });
408         tempMap.put("COT", new String JavaDoc[] { "America/Bogota" });
409         tempMap.put("CST",
410             new String JavaDoc[] {
411                 "Asia/Harbin", "Asia/Shanghai", "Asia/Chungking", "Asia/Urumqi",
412                 "Asia/Kashgar", "Asia/Taipei", "Asia/Macao", "Asia/Jayapura",
413                 "Australia/Darwin", "Australia/Adelaide",
414                 "Australia/Broken_Hill", "America/Chicago",
415                 "America/Indianapolis", "America/Indiana/Marengo",
416                 "America/Indiana/Knox", "America/Indiana/Vevay",
417                 "America/Louisville", "America/Detroit", "America/Menominee",
418                 "America/Rainy_River", "America/Winnipeg", "America/Regina",
419                 "America/Swift_Current", "America/Pangnirtung",
420                 "America/Iqaluit", "America/Rankin_Inlet",
421                 "America/Cambridge_Bay", "America/Cancun", "America/Mexico_City",
422                 "America/Chihuahua", "America/Hermosillo", "America/Mazatlan",
423                 "America/Belize", "America/Costa_Rica", "America/Havana",
424                 "America/El_Salvador", "America/Guatemala",
425                 "America/Tegucigalpa", "America/Managua"
426             });
427         tempMap.put("CUT", new String JavaDoc[] { "Europe/Zaporozhye" });
428         tempMap.put("CVST", new String JavaDoc[] { "Atlantic/Cape_Verde" });
429         tempMap.put("CVT", new String JavaDoc[] { "Atlantic/Cape_Verde" });
430         tempMap.put("CWT",
431             new String JavaDoc[] {
432                 "America/Chicago", "America/Indianapolis",
433                 "America/Indiana/Marengo", "America/Indiana/Knox",
434                 "America/Indiana/Vevay", "America/Louisville",
435                 "America/Menominee"
436             });
437         tempMap.put("CXT", new String JavaDoc[] { "Indian/Christmas" });
438         tempMap.put("DACT", new String JavaDoc[] { "Asia/Dacca" });
439         tempMap.put("DAVT", new String JavaDoc[] { "Antarctica/Davis" });
440         tempMap.put("DDUT", new String JavaDoc[] { "Antarctica/DumontDUrville" });
441         tempMap.put("DFT", new String JavaDoc[] { "Europe/Oslo", "Europe/Paris" });
442         tempMap.put("DMT", new String JavaDoc[] { "Europe/Belfast", "Europe/Dublin" });
443         tempMap.put("DUSST", new String JavaDoc[] { "Asia/Dushanbe" });
444         tempMap.put("DUST", new String JavaDoc[] { "Asia/Dushanbe" });
445         tempMap.put("EASST", new String JavaDoc[] { "Pacific/Easter" });
446         tempMap.put("EAST",
447             new String JavaDoc[] { "Indian/Antananarivo", "Pacific/Easter" });
448         tempMap.put("EAT",
449             new String JavaDoc[] {
450                 "Indian/Comoro", "Indian/Antananarivo", "Indian/Mayotte",
451                 "Africa/Djibouti", "Africa/Asmera", "Africa/Addis_Ababa",
452                 "Africa/Nairobi", "Africa/Mogadishu", "Africa/Khartoum",
453                 "Africa/Dar_es_Salaam", "Africa/Kampala"
454             });
455         tempMap.put("ECT",
456             new String JavaDoc[] { "Pacific/Galapagos", "America/Guayaquil" });
457         tempMap.put("EDDT", new String JavaDoc[] { "America/Iqaluit" });
458         tempMap.put("EDT",
459             new String JavaDoc[] {
460                 "America/New_York", "America/Indianapolis",
461                 "America/Indiana/Marengo", "America/Indiana/Vevay",
462                 "America/Louisville", "America/Detroit", "America/Montreal",
463                 "America/Thunder_Bay", "America/Nipigon", "America/Pangnirtung",
464                 "America/Iqaluit", "America/Cancun", "America/Nassau",
465                 "America/Santo_Domingo", "America/Port-au-Prince",
466                 "America/Jamaica", "America/Grand_Turk"
467             });
468         tempMap.put("EEMT",
469             new String JavaDoc[] {
470                 "Europe/Minsk", "Europe/Chisinau", "Europe/Tiraspol",
471                 "Europe/Kaliningrad", "Europe/Moscow"
472             });
473         tempMap.put("EEST",
474             new String JavaDoc[] {
475                 "Europe/Minsk", "Europe/Sofia", "Europe/Tallinn",
476                 "Europe/Helsinki", "Europe/Athens", "Europe/Riga",
477                 "Europe/Vilnius", "Europe/Chisinau", "Europe/Tiraspol",
478                 "Europe/Warsaw", "Europe/Bucharest", "Europe/Kaliningrad",
479                 "Europe/Moscow", "Europe/Istanbul", "Europe/Kiev",
480                 "Europe/Uzhgorod", "Europe/Zaporozhye", "Asia/Nicosia",
481                 "Asia/Amman", "Asia/Beirut", "Asia/Gaza", "Asia/Damascus",
482                 "Africa/Cairo"
483             });
484         tempMap.put("EET",
485             new String JavaDoc[] {
486                 "Europe/Minsk", "Europe/Sofia", "Europe/Tallinn",
487                 "Europe/Helsinki", "Europe/Athens", "Europe/Riga",
488                 "Europe/Vilnius", "Europe/Chisinau", "Europe/Tiraspol",
489                 "Europe/Warsaw", "Europe/Bucharest", "Europe/Kaliningrad",
490                 "Europe/Moscow", "Europe/Istanbul", "Europe/Kiev",
491                 "Europe/Uzhgorod", "Europe/Zaporozhye", "Europe/Simferopol",
492                 "Asia/Nicosia", "Asia/Amman", "Asia/Beirut", "Asia/Gaza",
493                 "Asia/Damascus", "Africa/Cairo", "Africa/Tripoli"
494             });
495         tempMap.put("EGST", new String JavaDoc[] { "America/Scoresbysund" });
496         tempMap.put("EGT",
497             new String JavaDoc[] { "Atlantic/Jan_Mayen", "America/Scoresbysund" });
498         tempMap.put("EHDT", new String JavaDoc[] { "America/Santo_Domingo" });
499         tempMap.put("EST",
500             new String JavaDoc[] {
501                 "Australia/Brisbane", "Australia/Lindeman", "Australia/Hobart",
502                 "Australia/Melbourne", "Australia/Sydney",
503                 "Australia/Broken_Hill", "Australia/Lord_Howe",
504                 "America/New_York", "America/Chicago", "America/Indianapolis",
505                 "America/Indiana/Marengo", "America/Indiana/Knox",
506                 "America/Indiana/Vevay", "America/Louisville", "America/Detroit",
507                 "America/Menominee", "America/Montreal", "America/Thunder_Bay",
508                 "America/Nipigon", "America/Pangnirtung", "America/Iqaluit",
509                 "America/Cancun", "America/Antigua", "America/Nassau",
510                 "America/Cayman", "America/Santo_Domingo",
511                 "America/Port-au-Prince", "America/Jamaica", "America/Managua",
512                 "America/Panama", "America/Grand_Turk"
513             });
514         tempMap.put("EWT",
515             new String JavaDoc[] {
516                 "America/New_York", "America/Indianapolis",
517                 "America/Indiana/Marengo", "America/Indiana/Vevay",
518                 "America/Louisville", "America/Detroit", "America/Jamaica"
519             });
520         tempMap.put("FFMT", new String JavaDoc[] { "America/Martinique" });
521         tempMap.put("FJST", new String JavaDoc[] { "Pacific/Fiji" });
522         tempMap.put("FJT", new String JavaDoc[] { "Pacific/Fiji" });
523         tempMap.put("FKST", new String JavaDoc[] { "Atlantic/Stanley" });
524         tempMap.put("FKT", new String JavaDoc[] { "Atlantic/Stanley" });
525         tempMap.put("FMT",
526             new String JavaDoc[] { "Atlantic/Madeira", "Africa/Freetown" });
527         tempMap.put("FNST", new String JavaDoc[] { "America/Noronha" });
528         tempMap.put("FNT", new String JavaDoc[] { "America/Noronha" });
529         tempMap.put("FRUST", new String JavaDoc[] { "Asia/Bishkek" });
530         tempMap.put("FRUT", new String JavaDoc[] { "Asia/Bishkek" });
531         tempMap.put("GALT", new String JavaDoc[] { "Pacific/Galapagos" });
532         tempMap.put("GAMT", new String JavaDoc[] { "Pacific/Gambier" });
533         tempMap.put("GBGT", new String JavaDoc[] { "America/Guyana" });
534         tempMap.put("GEST", new String JavaDoc[] { "Asia/Tbilisi" });
535         tempMap.put("GET", new String JavaDoc[] { "Asia/Tbilisi" });
536         tempMap.put("GFT", new String JavaDoc[] { "America/Cayenne" });
537         tempMap.put("GHST", new String JavaDoc[] { "Africa/Accra" });
538         tempMap.put("GILT", new String JavaDoc[] { "Pacific/Tarawa" });
539         tempMap.put("GMT",
540             new String JavaDoc[] {
541                 "Atlantic/St_Helena", "Atlantic/Reykjavik", "Europe/London",
542                 "Europe/Belfast", "Europe/Dublin", "Europe/Gibraltar",
543                 "Africa/Porto-Novo", "Africa/Ouagadougou", "Africa/Abidjan",
544                 "Africa/Malabo", "Africa/Banjul", "Africa/Accra",
545                 "Africa/Conakry", "Africa/Bissau", "Africa/Monrovia",
546                 "Africa/Bamako", "Africa/Timbuktu", "Africa/Nouakchott",
547                 "Africa/Niamey", "Africa/Sao_Tome", "Africa/Dakar",
548                 "Africa/Freetown", "Africa/Lome"
549             });
550         tempMap.put("GST",
551             new String JavaDoc[] {
552                 "Atlantic/South_Georgia", "Asia/Bahrain", "Asia/Muscat",
553                 "Asia/Qatar", "Asia/Dubai", "Pacific/Guam"
554             });
555         tempMap.put("GYT", new String JavaDoc[] { "America/Guyana" });
556         tempMap.put("HADT", new String JavaDoc[] { "America/Adak" });
557         tempMap.put("HART", new String JavaDoc[] { "Asia/Harbin" });
558         tempMap.put("HAST", new String JavaDoc[] { "America/Adak" });
559         tempMap.put("HAWT", new String JavaDoc[] { "America/Adak" });
560         tempMap.put("HDT", new String JavaDoc[] { "Pacific/Honolulu" });
561         tempMap.put("HKST", new String JavaDoc[] { "Asia/Hong_Kong" });
562         tempMap.put("HKT", new String JavaDoc[] { "Asia/Hong_Kong" });
563         tempMap.put("HMT",
564             new String JavaDoc[] {
565                 "Atlantic/Azores", "Europe/Helsinki", "Asia/Dacca",
566                 "Asia/Calcutta", "America/Havana"
567             });
568         tempMap.put("HOVST", new String JavaDoc[] { "Asia/Hovd" });
569         tempMap.put("HOVT", new String JavaDoc[] { "Asia/Hovd" });
570         tempMap.put("HST",
571             new String JavaDoc[] { "Pacific/Johnston", "Pacific/Honolulu" });
572         tempMap.put("HWT", new String JavaDoc[] { "Pacific/Honolulu" });
573         tempMap.put("ICT",
574             new String JavaDoc[] {
575                 "Asia/Phnom_Penh", "Asia/Vientiane", "Asia/Bangkok",
576                 "Asia/Saigon"
577             });
578         tempMap.put("IDDT", new String JavaDoc[] { "Asia/Jerusalem", "Asia/Gaza" });
579         tempMap.put("IDT", new String JavaDoc[] { "Asia/Jerusalem", "Asia/Gaza" });
580         tempMap.put("IHST", new String JavaDoc[] { "Asia/Colombo" });
581         tempMap.put("IMT",
582             new String JavaDoc[] { "Europe/Sofia", "Europe/Istanbul", "Asia/Irkutsk" });
583         tempMap.put("IOT", new String JavaDoc[] { "Indian/Chagos" });
584         tempMap.put("IRKMT", new String JavaDoc[] { "Asia/Irkutsk" });
585         tempMap.put("IRKST", new String JavaDoc[] { "Asia/Irkutsk" });
586         tempMap.put("IRKT", new String JavaDoc[] { "Asia/Irkutsk" });
587         tempMap.put("IRST", new String JavaDoc[] { "Asia/Tehran" });
588         tempMap.put("IRT", new String JavaDoc[] { "Asia/Tehran" });
589         tempMap.put("ISST", new String JavaDoc[] { "Atlantic/Reykjavik" });
590         tempMap.put("IST",
591             new String JavaDoc[] {
592                 "Atlantic/Reykjavik", "Europe/Belfast", "Europe/Dublin",
593                 "Asia/Dacca", "Asia/Thimbu", "Asia/Calcutta", "Asia/Jerusalem",
594                 "Asia/Katmandu", "Asia/Karachi", "Asia/Gaza", "Asia/Colombo"
595             });
596         tempMap.put("JAYT", new String JavaDoc[] { "Asia/Jayapura" });
597         tempMap.put("JMT",
598             new String JavaDoc[] { "Atlantic/St_Helena", "Asia/Jerusalem" });
599         tempMap.put("JST",
600             new String JavaDoc[] {
601                 "Asia/Rangoon", "Asia/Dili", "Asia/Ujung_Pandang", "Asia/Tokyo",
602                 "Asia/Kuala_Lumpur", "Asia/Kuching", "Asia/Manila",
603                 "Asia/Singapore", "Pacific/Nauru"
604             });
605         tempMap.put("KART", new String JavaDoc[] { "Asia/Karachi" });
606         tempMap.put("KAST", new String JavaDoc[] { "Asia/Kashgar" });
607         tempMap.put("KDT", new String JavaDoc[] { "Asia/Seoul" });
608         tempMap.put("KGST", new String JavaDoc[] { "Asia/Bishkek" });
609         tempMap.put("KGT", new String JavaDoc[] { "Asia/Bishkek" });
610         tempMap.put("KMT",
611             new String JavaDoc[] {
612                 "Europe/Vilnius", "Europe/Kiev", "America/Cayman",
613                 "America/Jamaica", "America/St_Vincent", "America/Grand_Turk"
614             });
615         tempMap.put("KOST", new String JavaDoc[] { "Pacific/Kosrae" });
616         tempMap.put("KRAMT", new String JavaDoc[] { "Asia/Krasnoyarsk" });
617         tempMap.put("KRAST", new String JavaDoc[] { "Asia/Krasnoyarsk" });
618         tempMap.put("KRAT", new String JavaDoc[] { "Asia/Krasnoyarsk" });
619         tempMap.put("KST", new String JavaDoc[] { "Asia/Seoul", "Asia/Pyongyang" });
620         tempMap.put("KUYMT", new String JavaDoc[] { "Europe/Samara" });
621         tempMap.put("KUYST", new String JavaDoc[] { "Europe/Samara" });
622         tempMap.put("KUYT", new String JavaDoc[] { "Europe/Samara" });
623         tempMap.put("KWAT", new String JavaDoc[] { "Pacific/Kwajalein" });
624         tempMap.put("LHST", new String JavaDoc[] { "Australia/Lord_Howe" });
625         tempMap.put("LINT", new String JavaDoc[] { "Pacific/Kiritimati" });
626         tempMap.put("LKT", new String JavaDoc[] { "Asia/Colombo" });
627         tempMap.put("LPMT", new String JavaDoc[] { "America/La_Paz" });
628         tempMap.put("LRT", new String JavaDoc[] { "Africa/Monrovia" });
629         tempMap.put("LST", new String JavaDoc[] { "Europe/Riga" });
630         tempMap.put("M", new String JavaDoc[] { "Europe/Moscow" });
631         tempMap.put("MADST", new String JavaDoc[] { "Atlantic/Madeira" });
632         tempMap.put("MAGMT", new String JavaDoc[] { "Asia/Magadan" });
633         tempMap.put("MAGST", new String JavaDoc[] { "Asia/Magadan" });
634         tempMap.put("MAGT", new String JavaDoc[] { "Asia/Magadan" });
635         tempMap.put("MALT",
636             new String JavaDoc[] { "Asia/Kuala_Lumpur", "Asia/Singapore" });
637         tempMap.put("MART", new String JavaDoc[] { "Pacific/Marquesas" });
638         tempMap.put("MAWT", new String JavaDoc[] { "Antarctica/Mawson" });
639         tempMap.put("MDDT",
640             new String JavaDoc[] {
641                 "America/Cambridge_Bay", "America/Yellowknife", "America/Inuvik"
642             });
643         tempMap.put("MDST", new String JavaDoc[] { "Europe/Moscow" });
644         tempMap.put("MDT",
645             new String JavaDoc[] {
646                 "America/Denver", "America/Phoenix", "America/Boise",
647                 "America/Regina", "America/Swift_Current", "America/Edmonton",
648                 "America/Cambridge_Bay", "America/Yellowknife", "America/Inuvik",
649                 "America/Chihuahua", "America/Hermosillo", "America/Mazatlan"
650             });
651         tempMap.put("MET",
652             new String JavaDoc[] {
653                 "Europe/Tirane", "Europe/Andorra", "Europe/Vienna",
654                 "Europe/Minsk", "Europe/Brussels", "Europe/Sofia",
655                 "Europe/Prague", "Europe/Copenhagen", "Europe/Tallinn",
656                 "Europe/Berlin", "Europe/Gibraltar", "Europe/Athens",
657                 "Europe/Budapest", "Europe/Rome", "Europe/Riga", "Europe/Vaduz",
658                 "Europe/Vilnius", "Europe/Luxembourg", "Europe/Malta",
659                 "Europe/Chisinau", "Europe/Tiraspol", "Europe/Monaco",
660                 "Europe/Amsterdam", "Europe/Oslo", "Europe/Warsaw",
661                 "Europe/Lisbon", "Europe/Kaliningrad", "Europe/Madrid",
662                 "Europe/Stockholm", "Europe/Zurich", "Europe/Kiev",
663                 "Europe/Uzhgorod", "Europe/Zaporozhye", "Europe/Simferopol",
664                 "Europe/Belgrade", "Africa/Algiers", "Africa/Tripoli",
665                 "Africa/Casablanca", "Africa/Tunis", "Africa/Ceuta"
666             });
667         tempMap.put("MHT",
668             new String JavaDoc[] { "Pacific/Majuro", "Pacific/Kwajalein" });
669         tempMap.put("MMT",
670             new String JavaDoc[] {
671                 "Indian/Maldives", "Europe/Minsk", "Europe/Moscow",
672                 "Asia/Rangoon", "Asia/Ujung_Pandang", "Asia/Colombo",
673                 "Pacific/Easter", "Africa/Monrovia", "America/Managua",
674                 "America/Montevideo"
675             });
676         tempMap.put("MOST", new String JavaDoc[] { "Asia/Macao" });
677         tempMap.put("MOT", new String JavaDoc[] { "Asia/Macao" });
678         tempMap.put("MPT", new String JavaDoc[] { "Pacific/Saipan" });
679         tempMap.put("MSK",
680             new String JavaDoc[] {
681                 "Europe/Minsk", "Europe/Tallinn", "Europe/Riga",
682                 "Europe/Vilnius", "Europe/Chisinau", "Europe/Kiev",
683                 "Europe/Uzhgorod", "Europe/Zaporozhye", "Europe/Simferopol"
684             });
685         tempMap.put("MST",
686             new String JavaDoc[] {
687                 "Europe/Moscow", "America/Denver", "America/Phoenix",
688                 "America/Boise", "America/Regina", "America/Swift_Current",
689                 "America/Edmonton", "America/Dawson_Creek",
690                 "America/Cambridge_Bay", "America/Yellowknife", "America/Inuvik",
691                 "America/Mexico_City", "America/Chihuahua", "America/Hermosillo",
692                 "America/Mazatlan", "America/Tijuana"
693             });
694         tempMap.put("MUT", new String JavaDoc[] { "Indian/Mauritius" });
695         tempMap.put("MVT", new String JavaDoc[] { "Indian/Maldives" });
696         tempMap.put("MWT",
697             new String JavaDoc[] { "America/Denver", "America/Phoenix", "America/Boise" });
698         tempMap.put("MYT", new String JavaDoc[] { "Asia/Kuala_Lumpur", "Asia/Kuching" });
699         tempMap.put("NCST", new String JavaDoc[] { "Pacific/Noumea" });
700         tempMap.put("NCT", new String JavaDoc[] { "Pacific/Noumea" });
701         tempMap.put("NDT",
702             new String JavaDoc[] {
703                 "America/Nome", "America/Adak", "America/St_Johns",
704                 "America/Goose_Bay"
705             });
706         tempMap.put("NEGT", new String JavaDoc[] { "America/Paramaribo" });
707         tempMap.put("NFT",
708             new String JavaDoc[] { "Europe/Paris", "Europe/Oslo", "Pacific/Norfolk" });
709         tempMap.put("NMT", new String JavaDoc[] { "Pacific/Norfolk" });
710         tempMap.put("NOVMT", new String JavaDoc[] { "Asia/Novosibirsk" });
711         tempMap.put("NOVST", new String JavaDoc[] { "Asia/Novosibirsk" });
712         tempMap.put("NOVT", new String JavaDoc[] { "Asia/Novosibirsk" });
713         tempMap.put("NPT", new String JavaDoc[] { "Asia/Katmandu" });
714         tempMap.put("NRT", new String JavaDoc[] { "Pacific/Nauru" });
715         tempMap.put("NST",
716             new String JavaDoc[] {
717                 "Europe/Amsterdam", "Pacific/Pago_Pago", "Pacific/Midway",
718                 "America/Nome", "America/Adak", "America/St_Johns",
719                 "America/Goose_Bay"
720             });
721         tempMap.put("NUT", new String JavaDoc[] { "Pacific/Niue" });
722         tempMap.put("NWT", new String JavaDoc[] { "America/Nome", "America/Adak" });
723         tempMap.put("NZDT", new String JavaDoc[] { "Antarctica/McMurdo" });
724         tempMap.put("NZHDT", new String JavaDoc[] { "Pacific/Auckland" });
725         tempMap.put("NZST",
726             new String JavaDoc[] { "Antarctica/McMurdo", "Pacific/Auckland" });
727         tempMap.put("OMSMT", new String JavaDoc[] { "Asia/Omsk" });
728         tempMap.put("OMSST", new String JavaDoc[] { "Asia/Omsk" });
729         tempMap.put("OMST", new String JavaDoc[] { "Asia/Omsk" });
730         tempMap.put("PDDT",
731             new String JavaDoc[] {
732                 "America/Inuvik", "America/Whitehorse", "America/Dawson"
733             });
734         tempMap.put("PDT",
735             new String JavaDoc[] {
736                 "America/Los_Angeles", "America/Juneau", "America/Boise",
737                 "America/Vancouver", "America/Dawson_Creek", "America/Inuvik",
738                 "America/Whitehorse", "America/Dawson", "America/Tijuana"
739             });
740         tempMap.put("PEST", new String JavaDoc[] { "America/Lima" });
741         tempMap.put("PET", new String JavaDoc[] { "America/Lima" });
742         tempMap.put("PETMT", new String JavaDoc[] { "Asia/Kamchatka" });
743         tempMap.put("PETST", new String JavaDoc[] { "Asia/Kamchatka" });
744         tempMap.put("PETT", new String JavaDoc[] { "Asia/Kamchatka" });
745         tempMap.put("PGT", new String JavaDoc[] { "Pacific/Port_Moresby" });
746         tempMap.put("PHOT", new String JavaDoc[] { "Pacific/Enderbury" });
747         tempMap.put("PHST", new String JavaDoc[] { "Asia/Manila" });
748         tempMap.put("PHT", new String JavaDoc[] { "Asia/Manila" });
749         tempMap.put("PKT", new String JavaDoc[] { "Asia/Karachi" });
750         tempMap.put("PMDT", new String JavaDoc[] { "America/Miquelon" });
751         tempMap.put("PMMT", new String JavaDoc[] { "Pacific/Port_Moresby" });
752         tempMap.put("PMST", new String JavaDoc[] { "America/Miquelon" });
753         tempMap.put("PMT",
754             new String JavaDoc[] {
755                 "Antarctica/DumontDUrville", "Europe/Prague", "Europe/Paris",
756                 "Europe/Monaco", "Africa/Algiers", "Africa/Tunis",
757                 "America/Panama", "America/Paramaribo"
758             });
759         tempMap.put("PNT", new String JavaDoc[] { "Pacific/Pitcairn" });
760         tempMap.put("PONT", new String JavaDoc[] { "Pacific/Ponape" });
761         tempMap.put("PPMT", new String JavaDoc[] { "America/Port-au-Prince" });
762         tempMap.put("PST",
763             new String JavaDoc[] {
764                 "Pacific/Pitcairn", "America/Los_Angeles", "America/Juneau",
765                 "America/Boise", "America/Vancouver", "America/Dawson_Creek",
766                 "America/Inuvik", "America/Whitehorse", "America/Dawson",
767                 "America/Hermosillo", "America/Mazatlan", "America/Tijuana"
768             });
769         tempMap.put("PWT",
770             new String JavaDoc[] {
771                 "Pacific/Palau", "America/Los_Angeles", "America/Juneau",
772                 "America/Boise", "America/Tijuana"
773             });
774         tempMap.put("PYST", new String JavaDoc[] { "America/Asuncion" });
775         tempMap.put("PYT", new String JavaDoc[] { "America/Asuncion" });
776         tempMap.put("QMT", new String JavaDoc[] { "America/Guayaquil" });
777         tempMap.put("RET", new String JavaDoc[] { "Indian/Reunion" });
778         tempMap.put("RMT",
779             new String JavaDoc[] {
780                 "Atlantic/Reykjavik", "Europe/Rome", "Europe/Riga",
781                 "Asia/Rangoon"
782             });
783         tempMap.put("S", new String JavaDoc[] { "Europe/Moscow" });
784         tempMap.put("SAMMT", new String JavaDoc[] { "Europe/Samara" });
785         tempMap.put("SAMST", new String JavaDoc[] { "Europe/Samara", "Asia/Samarkand" });
786         tempMap.put("SAMT",
787             new String JavaDoc[] {
788                 "Europe/Samara", "Asia/Samarkand", "Pacific/Pago_Pago",
789                 "Pacific/Apia"
790             });
791         tempMap.put("SAST",
792             new String JavaDoc[] {
793                 "Africa/Maseru", "Africa/Windhoek", "Africa/Johannesburg",
794                 "Africa/Mbabane"
795             });
796         tempMap.put("SBT", new String JavaDoc[] { "Pacific/Guadalcanal" });
797         tempMap.put("SCT", new String JavaDoc[] { "Indian/Mahe" });
798         tempMap.put("SDMT", new String JavaDoc[] { "America/Santo_Domingo" });
799         tempMap.put("SGT", new String JavaDoc[] { "Asia/Singapore" });
800         tempMap.put("SHEST", new String JavaDoc[] { "Asia/Aqtau" });
801         tempMap.put("SHET", new String JavaDoc[] { "Asia/Aqtau" });
802         tempMap.put("SJMT", new String JavaDoc[] { "America/Costa_Rica" });
803         tempMap.put("SLST", new String JavaDoc[] { "Africa/Freetown" });
804         tempMap.put("SMT",
805             new String JavaDoc[] {
806                 "Atlantic/Stanley", "Europe/Stockholm", "Europe/Simferopol",
807                 "Asia/Phnom_Penh", "Asia/Vientiane", "Asia/Kuala_Lumpur",
808                 "Asia/Singapore", "Asia/Saigon", "America/Santiago"
809             });
810         tempMap.put("SRT", new String JavaDoc[] { "America/Paramaribo" });
811         tempMap.put("SST",
812             new String JavaDoc[] { "Pacific/Pago_Pago", "Pacific/Midway" });
813         tempMap.put("SVEMT", new String JavaDoc[] { "Asia/Yekaterinburg" });
814         tempMap.put("SVEST", new String JavaDoc[] { "Asia/Yekaterinburg" });
815         tempMap.put("SVET", new String JavaDoc[] { "Asia/Yekaterinburg" });
816         tempMap.put("SWAT", new String JavaDoc[] { "Africa/Windhoek" });
817         tempMap.put("SYOT", new String JavaDoc[] { "Antarctica/Syowa" });
818         tempMap.put("TAHT", new String JavaDoc[] { "Pacific/Tahiti" });
819         tempMap.put("TASST", new String JavaDoc[] { "Asia/Samarkand", "Asia/Tashkent" });
820         tempMap.put("TAST", new String JavaDoc[] { "Asia/Samarkand", "Asia/Tashkent" });
821         tempMap.put("TBIST", new String JavaDoc[] { "Asia/Tbilisi" });
822         tempMap.put("TBIT", new String JavaDoc[] { "Asia/Tbilisi" });
823         tempMap.put("TBMT", new String JavaDoc[] { "Asia/Tbilisi" });
824         tempMap.put("TFT", new String JavaDoc[] { "Indian/Kerguelen" });
825         tempMap.put("TJT", new String JavaDoc[] { "Asia/Dushanbe" });
826         tempMap.put("TKT", new String JavaDoc[] { "Pacific/Fakaofo" });
827         tempMap.put("TMST", new String JavaDoc[] { "Asia/Ashkhabad" });
828         tempMap.put("TMT",
829             new String JavaDoc[] { "Europe/Tallinn", "Asia/Tehran", "Asia/Ashkhabad" });
830         tempMap.put("TOST", new String JavaDoc[] { "Pacific/Tongatapu" });
831         tempMap.put("TOT", new String JavaDoc[] { "Pacific/Tongatapu" });
832         tempMap.put("TPT", new String JavaDoc[] { "Asia/Dili" });
833         tempMap.put("TRST", new String JavaDoc[] { "Europe/Istanbul" });
834         tempMap.put("TRT", new String JavaDoc[] { "Europe/Istanbul" });
835         tempMap.put("TRUT", new String JavaDoc[] { "Pacific/Truk" });
836         tempMap.put("TVT", new String JavaDoc[] { "Pacific/Funafuti" });
837         tempMap.put("ULAST", new String JavaDoc[] { "Asia/Ulaanbaatar" });
838         tempMap.put("ULAT", new String JavaDoc[] { "Asia/Ulaanbaatar" });
839         tempMap.put("URUT", new String JavaDoc[] { "Asia/Urumqi" });
840         tempMap.put("UYHST", new String JavaDoc[] { "America/Montevideo" });
841         tempMap.put("UYT", new String JavaDoc[] { "America/Montevideo" });
842         tempMap.put("UZST", new String JavaDoc[] { "Asia/Samarkand", "Asia/Tashkent" });
843         tempMap.put("UZT", new String JavaDoc[] { "Asia/Samarkand", "Asia/Tashkent" });
844         tempMap.put("VET", new String JavaDoc[] { "America/Caracas" });
845         tempMap.put("VLAMT", new String JavaDoc[] { "Asia/Vladivostok" });
846         tempMap.put("VLAST", new String JavaDoc[] { "Asia/Vladivostok" });
847         tempMap.put("VLAT", new String JavaDoc[] { "Asia/Vladivostok" });
848         tempMap.put("VUST", new String JavaDoc[] { "Pacific/Efate" });
849         tempMap.put("VUT", new String JavaDoc[] { "Pacific/Efate" });
850         tempMap.put("WAKT", new String JavaDoc[] { "Pacific/Wake" });
851         tempMap.put("WARST", new String JavaDoc[] { "America/Jujuy", "America/Mendoza" });
852         tempMap.put("WART", new String JavaDoc[] { "America/Jujuy", "America/Mendoza" });
853         tempMap.put("WAST",
854             new String JavaDoc[] { "Africa/Ndjamena", "Africa/Windhoek" });
855         tempMap.put("WAT",
856             new String JavaDoc[] {
857                 "Africa/Luanda", "Africa/Porto-Novo", "Africa/Douala",
858                 "Africa/Bangui", "Africa/Ndjamena", "Africa/Kinshasa",
859                 "Africa/Brazzaville", "Africa/Malabo", "Africa/Libreville",
860                 "Africa/Banjul", "Africa/Conakry", "Africa/Bissau",
861                 "Africa/Bamako", "Africa/Nouakchott", "Africa/El_Aaiun",
862                 "Africa/Windhoek", "Africa/Niamey", "Africa/Lagos",
863                 "Africa/Dakar", "Africa/Freetown"
864             });
865         tempMap.put("WEST",
866             new String JavaDoc[] {
867                 "Atlantic/Faeroe", "Atlantic/Azores", "Atlantic/Madeira",
868                 "Atlantic/Canary", "Europe/Brussels", "Europe/Luxembourg",
869                 "Europe/Monaco", "Europe/Lisbon", "Europe/Madrid",
870                 "Africa/Algiers", "Africa/Casablanca", "Africa/Ceuta"
871             });
872         tempMap.put("WET",
873             new String JavaDoc[] {
874                 "Atlantic/Faeroe", "Atlantic/Azores", "Atlantic/Madeira",
875                 "Atlantic/Canary", "Europe/Andorra", "Europe/Brussels",
876                 "Europe/Luxembourg", "Europe/Monaco", "Europe/Lisbon",
877                 "Europe/Madrid", "Africa/Algiers", "Africa/Casablanca",
878                 "Africa/El_Aaiun", "Africa/Ceuta"
879             });
880         tempMap.put("WFT", new String JavaDoc[] { "Pacific/Wallis" });
881         tempMap.put("WGST", new String JavaDoc[] { "America/Godthab" });
882         tempMap.put("WGT", new String JavaDoc[] { "America/Godthab" });
883         tempMap.put("WMT", new String JavaDoc[] { "Europe/Vilnius", "Europe/Warsaw" });
884         tempMap.put("WST",
885             new String JavaDoc[] { "Antarctica/Casey", "Pacific/Apia", "Australia/Perth" });
886         tempMap.put("YAKMT", new String JavaDoc[] { "Asia/Yakutsk" });
887         tempMap.put("YAKST", new String JavaDoc[] { "Asia/Yakutsk" });
888         tempMap.put("YAKT", new String JavaDoc[] { "Asia/Yakutsk" });
889         tempMap.put("YAPT", new String JavaDoc[] { "Pacific/Yap" });
890         tempMap.put("YDDT",
891             new String JavaDoc[] { "America/Whitehorse", "America/Dawson" });
892         tempMap.put("YDT",
893             new String JavaDoc[] {
894                 "America/Yakutat", "America/Whitehorse", "America/Dawson"
895             });
896         tempMap.put("YEKMT", new String JavaDoc[] { "Asia/Yekaterinburg" });
897         tempMap.put("YEKST", new String JavaDoc[] { "Asia/Yekaterinburg" });
898         tempMap.put("YEKT", new String JavaDoc[] { "Asia/Yekaterinburg" });
899         tempMap.put("YERST", new String JavaDoc[] { "Asia/Yerevan" });
900         tempMap.put("YERT", new String JavaDoc[] { "Asia/Yerevan" });
901         tempMap.put("YST",
902             new String JavaDoc[] {
903                 "America/Yakutat", "America/Whitehorse", "America/Dawson"
904             });
905         tempMap.put("YWT", new String JavaDoc[] { "America/Yakutat" });
906
907         ABBREVIATED_TIMEZONES = Collections.unmodifiableMap(tempMap);
908     }
909
910     /**
911      * Returns the 'official' Java timezone name for the given timezone
912      *
913      * @param timezoneStr the 'common' timezone name
914      *
915      * @return the Java timezone name for the given timezone
916      */

917     public static String JavaDoc getCanoncialTimezone(String JavaDoc timezoneStr) {
918         if (timezoneStr == null) {
919             return null;
920         }
921
922         timezoneStr = timezoneStr.trim();
923
924         // Fix windows Daylight/Standard shift JDK doesn't map these (doh)
925
String JavaDoc timezoneStrUC = timezoneStr.toUpperCase();
926         int daylightIndex = timezoneStrUC.indexOf("DAYLIGHT");
927
928         if (daylightIndex != -1) {
929             StringBuffer JavaDoc timezoneBuf = new StringBuffer JavaDoc();
930             timezoneBuf.append(timezoneStr.substring(0, daylightIndex));
931             timezoneBuf.append("Standard");
932             timezoneBuf.append(timezoneStr.substring(daylightIndex
933                     + "DAYLIGHT".length(), timezoneStr.length()));
934             timezoneStr = timezoneBuf.toString();
935         }
936
937         String JavaDoc canonicalTz = (String JavaDoc) TIMEZONE_MAPPINGS.get(timezoneStr);
938
939         // if we didn't find it, try abbreviated timezones
940
if (canonicalTz == null) {
941             String JavaDoc[] abbreviatedTimezone = (String JavaDoc[]) ABBREVIATED_TIMEZONES.get(timezoneStr);
942
943             if (abbreviatedTimezone != null) {
944                 // If there's only one mapping use that
945
if (abbreviatedTimezone.length == 1) {
946                     canonicalTz = abbreviatedTimezone[0];
947                 } else {
948                     StringBuffer JavaDoc errorMsg = new StringBuffer JavaDoc(
949                             "The server timezone value '");
950                     errorMsg.append(timezoneStr);
951                     errorMsg.append(
952                         "' represents more than one timezone. You must ");
953                     errorMsg.append(
954                         "configure either the server or client to use a ");
955                     errorMsg.append(
956                         "more specifc timezone value if you want to enable ");
957                     errorMsg.append("timezone support. The timezones that '");
958                     errorMsg.append(timezoneStr);
959                     errorMsg.append("maps to are: ");
960                     errorMsg.append(abbreviatedTimezone[0]);
961
962                     for (int i = 1; i < abbreviatedTimezone.length; i++) {
963                         errorMsg.append(", ");
964                         errorMsg.append(abbreviatedTimezone[i]);
965                     }
966
967                     throw new IllegalArgumentException JavaDoc(errorMsg.toString());
968                 }
969             }
970         }
971
972         return canonicalTz;
973     }
974
975     /**
976      * Change the given timestamp from one timezone to another
977      *
978      * @param conn the current connection to the MySQL server
979      * @param tstamp the timestamp to change
980      * @param fromTz the timezone to change from
981      * @param toTz the timezone to change to
982      *
983      * @return the timestamp changed to the timezone 'toTz'
984      */

985     public static Timestamp JavaDoc changeTimezone(Connection conn, Timestamp JavaDoc tstamp,
986         TimeZone JavaDoc fromTz, TimeZone JavaDoc toTz) {
987         if ((conn != null) && conn.useTimezone()) {
988             // Convert the timestamp from GMT to the server's timezone
989
Calendar JavaDoc fromCal = Calendar.getInstance(fromTz);
990             fromCal.setTime(tstamp);
991
992             int fromOffset = fromCal.get(Calendar.ZONE_OFFSET)
993                 + fromCal.get(Calendar.DST_OFFSET);
994             Calendar JavaDoc toCal = Calendar.getInstance(toTz);
995             toCal.setTime(tstamp);
996
997             int toOffset = toCal.get(Calendar.ZONE_OFFSET)
998                 + toCal.get(Calendar.DST_OFFSET);
999             int offsetDiff = toOffset - fromOffset;
1000            long toTime = toCal.getTime().getTime();
1001            toTime += offsetDiff;
1002
1003            Timestamp JavaDoc changedTimestamp = new Timestamp JavaDoc(toTime);
1004
1005            return changedTimestamp;
1006        } else {
1007            return tstamp;
1008        }
1009    }
1010
1011    /**
1012     * Change the given times from one timezone to another
1013     *
1014     * @param conn the current connection to the MySQL server
1015     * @param t the times to change
1016     * @param fromTz the timezone to change from
1017     * @param toTz the timezone to change to
1018     *
1019     * @return the times changed to the timezone 'toTz'
1020     */

1021    public static Time JavaDoc changeTimezone(Connection conn, Time JavaDoc t, TimeZone JavaDoc fromTz,
1022        TimeZone JavaDoc toTz) {
1023        if ((conn != null) && conn.useTimezone()) {
1024            // Convert the timestamp from GMT to the server's timezone
1025
Calendar JavaDoc fromCal = Calendar.getInstance(fromTz);
1026            fromCal.setTime(t);
1027
1028            int fromOffset = fromCal.get(Calendar.ZONE_OFFSET)
1029                + fromCal.get(Calendar.DST_OFFSET);
1030            Calendar JavaDoc toCal = Calendar.getInstance(toTz);
1031            toCal.setTime(t);
1032
1033            int toOffset = toCal.get(Calendar.ZONE_OFFSET)
1034                + toCal.get(Calendar.DST_OFFSET);
1035            int offsetDiff = toOffset - fromOffset;
1036            long toTime = toCal.getTime().getTime();
1037            toTime += offsetDiff;
1038
1039            Time JavaDoc changedTime = new Time JavaDoc(toTime);
1040
1041            return changedTime;
1042        } else {
1043            return t;
1044        }
1045    }
1046}
1047
Popular Tags