Thursday, 4 March 2010

Time Zone Abbreviations

Yesterday, I faced an annoying problem when parsing a Yahoo Weather API RSS feed. The RSS lastBuildDate element returned:

Tue, 03 Mar 2010 8:17 pm AEST

All good, except that I could not parse AEDT using a Java SimpleDateFormat whose JavaDoc explains:
"For formatting, if the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available."
Not surprisingly, then, my code:

String date = "Tue, 03 Mar 2010 8:17 pm AEST";
SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm aa zzzz");
try {
Date res = df.parse(date);
} catch (ParseException e1) {

Results in:

java.text.ParseException: Unparseable date: "Tue, 03 Mar 2010 8:17 pm AEST"
at java.text.DateFormat.parse(
at WeatherTest.main(

To deal with this, I had to write some Java whose job it is to normalise any time zone abbreviation - not just three letter ones or those in RFC 822.

The crux of the issue is that I found it difficult to get a comprehensive list of time zone abbreviations in common use. Wikipedia has an incomplete list (for example, AEDT is missing); is more comprehensive, but not in a suitable format.

So, to save effort for anyone who follows, here is my 1 hour hack at a list of common time-zone abbreviations including everything from the two sources cited, and knocked into a simple XML format. As you will see, a number of abbreviations are not unique.

I shall not bother publishing the Java that uses this...

As usual, this is published as is in the hope that it is useful to someone. It is likely to be incomplete and might even be inaccurate. If you find any errors, drop me a line and I will try and fix them.

xml version="1.0" encoding="UTF-8"?>
<zoneAbbreviation abbr="A" utcOffset="+1000" name="Alpha Time Zone" />
<zoneAbbreviation abbr="ACDT" utcOffset="+1030" name="Australian Central Daylight Time" />
<zoneAbbreviation abbr="ACST" utcOffset="+0930" name="Australian Central Standard Time" />
<zoneAbbreviation abbr="ACT" utcOffset="+0800" name="ASEAN Common Time" />
<zoneAbbreviation abbr="ADT" utcOffset="-0300" name="Atlantic Daylight Time" />
<zoneAbbreviation abbr="AEDT" utcOffset="+1100" name="Australian Eastern Daylight Time or Australian Eastern Summer Time" />
<zoneAbbreviation abbr="AEST" utcOffset="+1000" name="Australian Eastern Standard Time" />
<zoneAbbreviation abbr="AFT" utcOffset="+0430" name="Afghanistan Time" />
<zoneAbbreviation abbr="AKDT" utcOffset="-0800" name="Alaska Daylight Time" />
<zoneAbbreviation abbr="AKST" utcOffset="-0900" name="Alaska Standard Time" />
<zoneAbbreviation abbr="AMST" utcOffset="+0500" name="Armenia Summer Time" />
<zoneAbbreviation abbr="AMT" utcOffset="+0400" name="Armenia Time" />
<zoneAbbreviation abbr="ART" utcOffset="-0300" name="Argentina Time" />
<zoneAbbreviation abbr="AST" utcOffset="-0400" name="Atlantic Standard Time" />
<zoneAbbreviation abbr="AWDT" utcOffset="+0900" name="Australian Western Daylight Time" />
<zoneAbbreviation abbr="AWST" utcOffset="+0800" name="Australian Western Standard Time" />
<zoneAbbreviation abbr="AZOST" utcOffset="-0100" name="Azores Standard Time" />
<zoneAbbreviation abbr="AZT" utcOffset="+0400" name="Azerbaijan Time" />
<zoneAbbreviation abbr="B" utcOffset="+0200" name="Bravo Time Zone" />
<zoneAbbreviation abbr="BDT" utcOffset="+0800" name="Brunei Time" />
<zoneAbbreviation abbr="BIOT" utcOffset="+0600" name="British Indian Ocean Time" />
<zoneAbbreviation abbr="BIT" utcOffset="-1200" name="Baker Island Time" />
<zoneAbbreviation abbr="BOT" utcOffset="-0400" name="Bolivia Time" />
<zoneAbbreviation abbr="BRT" utcOffset="-0300" name="Brasilia Time" />
<zoneAbbreviation abbr="BST" utcOffset="+1000" name="British Summer Time" />
<zoneAbbreviation abbr="BST" utcOffset="+0600" name="Bangladesh Standard Time" />
<zoneAbbreviation abbr="BTT" utcOffset="+0600" name="Bhutan Time" />
<zoneAbbreviation abbr="C" utcOffset="+0300" name="Charlie Time Zone" />
<zoneAbbreviation abbr="CAT" utcOffset="+0200" name="Central Africa Time" />
<zoneAbbreviation abbr="CCT" utcOffset="+0630" name="Cocos Islands Time" />
<zoneAbbreviation abbr="CDT" utcOffset="+1030" name="Central Daylight Time" />
<zoneAbbreviation abbr="CDT" utcOffset="-0500" name="Central Daylight Time" />
<zoneAbbreviation abbr="CDT" utcOffset="-0500" name="Central Daylight Time (North America)" />
<zoneAbbreviation abbr="CEDT" utcOffset="+0200" name="Central European Daylight Time" />
<zoneAbbreviation abbr="CEST" utcOffset="+0200" name="Central European Summer Time" />
<zoneAbbreviation abbr="CET" utcOffset="+1000" name="Central European Time" />
<zoneAbbreviation abbr="CET" utcOffset="+0100" name="Central European Time" />
<zoneAbbreviation abbr="CHAST" utcOffset="+1245" name="Chatham Standard Time" />
<zoneAbbreviation abbr="ChST" utcOffset="+1000" name="Chamorro Standard Time" />
<zoneAbbreviation abbr="CIST" utcOffset="-0800" name="Clipperton Island Standard Time" />
<zoneAbbreviation abbr="CKT" utcOffset="-1000" name="Cook Island Time" />
<zoneAbbreviation abbr="CLST" utcOffset="-0300" name="Chile Summer Time" />
<zoneAbbreviation abbr="CLT" utcOffset="-0400" name="Chile Standard Time" />
<zoneAbbreviation abbr="COST" utcOffset="-0400" name="Colombia Summer Time" />
<zoneAbbreviation abbr="COT" utcOffset="-0500" name="Colombia Time" />
<zoneAbbreviation abbr="CST" utcOffset="+0930" name="Central Standard Time" />
<zoneAbbreviation abbr="CST" utcOffset="+1030" name="Central Summer Time" />
<zoneAbbreviation abbr="CST" utcOffset="-0600" name="Central Standard Time" />
<zoneAbbreviation abbr="CST" utcOffset="+0800" name="China Standard Time" />
<zoneAbbreviation abbr="CST" utcOffset="-0600" name="Central Standard Time (North America)" />
<zoneAbbreviation abbr="CVT" utcOffset="-0100" name="Cape Verde Time" />
<zoneAbbreviation abbr="CXT" utcOffset="+0700" name="Christmas Island Time" />
<zoneAbbreviation abbr="D" utcOffset="+0400" name="Delta Time Zone" />
<zoneAbbreviation abbr="E" utcOffset="+0500" name="Echo Time Zone" />
<zoneAbbreviation abbr="EAST" utcOffset="-0600" name="Easter Island Standard Time" />
<zoneAbbreviation abbr="EAT" utcOffset="+0300" name="East Africa Time" />
<zoneAbbreviation abbr="ECT" utcOffset="-0400" name="Eastern Caribbean Time" />
<zoneAbbreviation abbr="ECT" utcOffset="-0500" name="Ecuador Time" />
<zoneAbbreviation abbr="EDT" utcOffset="+1100" name="Eastern Daylight Time" />
<zoneAbbreviation abbr="EDT" utcOffset="-0400" name="Eastern Daylight Time" />
<zoneAbbreviation abbr="EDT" utcOffset="-0400" name="Eastern Daylight Time (North America)" />
<zoneAbbreviation abbr="EEDT" utcOffset="+0300" name="Eastern European Daylight Time" />
<zoneAbbreviation abbr="EEST" utcOffset="+0300" name="Eastern European Summer Time" />
<zoneAbbreviation abbr="EET" utcOffset="+0200" name="Eastern European Time" />
<zoneAbbreviation abbr="EST" utcOffset="+1000" name="Eastern Standard Time" />
<zoneAbbreviation abbr="EST" utcOffset="+1100" name="Eastern Summer Time" />
<zoneAbbreviation abbr="EST" utcOffset="-0500" name="Eastern Standard Time" />
<zoneAbbreviation abbr="EST" utcOffset="-0500" name="Eastern Standard Time (North America)" />
<zoneAbbreviation abbr="F" utcOffset="+0600" name="Foxtrot Time Zone" />
<zoneAbbreviation abbr="FJT" utcOffset="+1200" name="Fiji Time" />
<zoneAbbreviation abbr="FKST" utcOffset="-0400" name="Falkland Islands Standard Time" />
<zoneAbbreviation abbr="G" utcOffset="+0700" name="Golf Time Zone" />
<zoneAbbreviation abbr="GALT" utcOffset="-0600" name="Galapagos Time" />
<zoneAbbreviation abbr="GET" utcOffset="+0400" name="Georgia Standard Time" />
<zoneAbbreviation abbr="GFT" utcOffset="-0300" name="French Guiana Time" />
<zoneAbbreviation abbr="GILT" utcOffset="+1200" name="Gilbert Island Time" />
<zoneAbbreviation abbr="GIT" utcOffset="-0900" name="Gambier Island Time" />
<zoneAbbreviation abbr="GMT" utcOffset="+0000" name="Greenwich Mean Time" />
<zoneAbbreviation abbr="GST" utcOffset="-0200" name="South Georgia and the South Sandwich Islands" />
<zoneAbbreviation abbr="GYT" utcOffset="-0400" name="Guyana Time" />
<zoneAbbreviation abbr="H" utcOffset="+0800" name="Hotel Time Zone" />
<zoneAbbreviation abbr="HAA" utcOffset="-0300" name="Heure Avancée de l'Atlantique" />
<zoneAbbreviation abbr="HAC" utcOffset="-0500" name="Heure Avancée du Centre" />
<zoneAbbreviation abbr="HADT" utcOffset="-0900" name="Hawaii-Aleutian Daylight Time" />
<zoneAbbreviation abbr="HAE" utcOffset="-0400" name="Heure Avancée de l'Est" />
<zoneAbbreviation abbr="HAP" utcOffset="-0700" name="Heure Avancée du Pacifique" />
<zoneAbbreviation abbr="HAR" utcOffset="-0600" name="Heure Avancée des Rocheuses" />
<zoneAbbreviation abbr="HAST" utcOffset="-10" name="Hawaii-Aleutian Standard Time" />
<zoneAbbreviation abbr="HAST" utcOffset="-1000" name="Hawaii-Aleutian Standard Time" />
<zoneAbbreviation abbr="HAT" utcOffset="-0230" name="Heure Avancée de Terre-Neuve" />
<zoneAbbreviation abbr="HAY" utcOffset="-0800" name="Heure Avancée du Yukon" />
<zoneAbbreviation abbr="HKT" utcOffset="+0800" name="Hong Kong Time" />
<zoneAbbreviation abbr="HMT" utcOffset="+0500" name="Heard and McDonald Islands Time" />
<zoneAbbreviation abbr="HNA" utcOffset="-0400" name="Heure Normale de l'Atlantique" />
<zoneAbbreviation abbr="HNC" utcOffset="-0600" name="Heure Normale du Centre" />
<zoneAbbreviation abbr="HNE" utcOffset="-0500" name="Heure Normale de l'Est" />
<zoneAbbreviation abbr="HNP" utcOffset="-0800" name="Heure Normale du Pacifique" />
<zoneAbbreviation abbr="HNR" utcOffset="-0700" name="Heure Normale des Rocheuses" />
<zoneAbbreviation abbr="HNT" utcOffset="-0330" name="Heure Normale de Terre-Neuve" />
<zoneAbbreviation abbr="HNY" utcOffset="-0900" name="Heure Normale du Yukon" />
<zoneAbbreviation abbr="HST" utcOffset="-10" name="Hawaii Standard Time" />
<zoneAbbreviation abbr="I" utcOffset="+0900" name="India Time Zone" />
<zoneAbbreviation abbr="IRKT" utcOffset="+0800" name="Irkutsk Time" />
<zoneAbbreviation abbr="IRST" utcOffset="+0330" name="Iran Standard Time" />
<zoneAbbreviation abbr="IST" utcOffset="+1000" name="Irish Summer Time" />
<zoneAbbreviation abbr="IST" utcOffset="+0200" name="Israel Standard Time" />
<zoneAbbreviation abbr="IST" utcOffset="+0530" name="Indian Standard Time" />
<zoneAbbreviation abbr="JST" utcOffset="+0900" name="Japan Standard Time" />
<zoneAbbreviation abbr="K" utcOffset="+1000" name="Kilo Time Zone" />
<zoneAbbreviation abbr="KRAT" utcOffset="+0700" name="Krasnoyarsk Time" />
<zoneAbbreviation abbr="KST" utcOffset="+0900" name="Korea Standard Time" />
<zoneAbbreviation abbr="L" utcOffset="+1100" name="Lima Time Zone" />
<zoneAbbreviation abbr="LHST" utcOffset="+1030" name="Lord Howe Standard Time" />
<zoneAbbreviation abbr="LINT" utcOffset="+1400" name="Line Islands Time" />
<zoneAbbreviation abbr="M" utcOffset="+1200" name="Mike Time Zone" />
<zoneAbbreviation abbr="MAGT" utcOffset="+1100" name="Magadan Time" />
<zoneAbbreviation abbr="MDT" utcOffset="-0600" name="Mountain Daylight Time" />
<zoneAbbreviation abbr="MDT" utcOffset="-0600" name="Mountain Daylight Time (North America)" />
<zoneAbbreviation abbr="MESZ" utcOffset="+0200" name="Mitteleuroäische Sommerzeit" />
<zoneAbbreviation abbr="MEZ" utcOffset="+1000" name="Mitteleuropäische Zeit" />
<zoneAbbreviation abbr="MIT" utcOffset="-0930" name="Marquesas Islands Time" />
<zoneAbbreviation abbr="MSD" utcOffset="+0400" name="Moscow Daylight Time" />
<zoneAbbreviation abbr="MSK" utcOffset="+0300" name="Moscow Standard Time" />
<zoneAbbreviation abbr="MST" utcOffset="-0700" name="Mountain Standard Time" />
<zoneAbbreviation abbr="MST" utcOffset="+0630" name="Myanmar Standard Time" />
<zoneAbbreviation abbr="MST" utcOffset="+0800" name="Malaysian Standard Time" />
<zoneAbbreviation abbr="MST" utcOffset="-0700" name="Mountain Standard Time (North America)" />
<zoneAbbreviation abbr="MUT" utcOffset="+0400" name="Mauritius Time" />
<zoneAbbreviation abbr="N" utcOffset="-1000" name="November Time Zone" />
<zoneAbbreviation abbr="NDT" utcOffset="-0230" name="Newfoundland Daylight Time" />
<zoneAbbreviation abbr="NFT" utcOffset="+1130" name="Norfolk (Island) Time" />
<zoneAbbreviation abbr="NFT" utcOffset="+1130" name="Norfolk Time" />
<zoneAbbreviation abbr="NPT" utcOffset="+0545" name="Nepal Time" />
<zoneAbbreviation abbr="NST" utcOffset="-0330" name="Newfoundland Standard Time" />
<zoneAbbreviation abbr="NT" utcOffset="-0330" name="Newfoundland Time" />
<zoneAbbreviation abbr="O" utcOffset="-0200" name="Oscar Time Zone" />
<zoneAbbreviation abbr="OMST" utcOffset="+0600" name="Omsk Time" />
<zoneAbbreviation abbr="P" utcOffset="-0300" name="Papa Time Zone" />
<zoneAbbreviation abbr="PDT" utcOffset="-0700" name="Pacific Daylight Time" />
<zoneAbbreviation abbr="PDT" utcOffset="-0700" name="Pacific Daylight Time (North America)" />
<zoneAbbreviation abbr="PETT" utcOffset="+1200" name="Kamchatka Time" />
<zoneAbbreviation abbr="PHOT" utcOffset="+1300" name="Phoenix Island Time" />
<zoneAbbreviation abbr="PKT" utcOffset="+0500" name="Pakistan Standard Time" />
<zoneAbbreviation abbr="PST" utcOffset="-0800" name="Pacific Standard Time" />
<zoneAbbreviation abbr="PST" utcOffset="+0800" name="Philippine Standard Time" />
<zoneAbbreviation abbr="PST" utcOffset="-0800" name="Pacific Standard Time (North America)" />
<zoneAbbreviation abbr="Q" utcOffset="-0400" name="Quebec Time Zone" />
<zoneAbbreviation abbr="R" utcOffset="-0500" name="Romeo Time Zone" />
<zoneAbbreviation abbr="RET" utcOffset="+0400" name="Réunion Time" />
<zoneAbbreviation abbr="S" utcOffset="-0600" name="Sierra Time Zone" />
<zoneAbbreviation abbr="SAMT" utcOffset="+0400" name="Samara Time" />
<zoneAbbreviation abbr="SAST" utcOffset="+0200" name="South African Standard Time" />
<zoneAbbreviation abbr="SBT" utcOffset="+1100" name="Solomon Islands Time" />
<zoneAbbreviation abbr="SCT" utcOffset="+0400" name="Seychelles Time" />
<zoneAbbreviation abbr="SLT" utcOffset="+0530" name="Sri Lanka Time" />
<zoneAbbreviation abbr="SST" utcOffset="+0800" name="Singapore Standard Time" />
<zoneAbbreviation abbr="SST" utcOffset="-1100" name="Samoa Standard Time" />
<zoneAbbreviation abbr="T" utcOffset="-0700" name="Tango Time Zone" />
<zoneAbbreviation abbr="TAHT" utcOffset="-1000" name="Tahiti Time" />
<zoneAbbreviation abbr="THA" utcOffset="-0700" name="Thailand Standard Time" />
<zoneAbbreviation abbr="U" utcOffset="-0800" name="Uniform Time Zone" />
<zoneAbbreviation abbr="UTC" utcOffset="+0000" name="Coordinated Universal Time" />
<zoneAbbreviation abbr="UYST" utcOffset="-0200" name="Uruguay Summer Time" />
<zoneAbbreviation abbr="UYT" utcOffset="-0300" name="Uruguay Standard Time" />
<zoneAbbreviation abbr="V" utcOffset="-0900" name="Victor Time Zone" />
<zoneAbbreviation abbr="VET" utcOffset="-0430" name="Venezuelan Standard Time" />
<zoneAbbreviation abbr="VLAT" utcOffset="+1000" name="Vladivostok Time" />
<zoneAbbreviation abbr="W" utcOffset="-1000" name="Whiskey Time Zone" />
<zoneAbbreviation abbr="WAT" utcOffset="+0100" name="West Africa Time" />
<zoneAbbreviation abbr="WDT" utcOffset="+0900" name="Western Daylight Time" />
<zoneAbbreviation abbr="WEDT" utcOffset="+1000" name="Western European Daylight Time" />
<zoneAbbreviation abbr="WEST" utcOffset="+1000" name="Western European Summer Time" />
<zoneAbbreviation abbr="WEST" utcOffset="+0100" name="Western European Summer Time" />
<zoneAbbreviation abbr="WET" utcOffset="+0000" name="Western European Time" />
<zoneAbbreviation abbr="WST" utcOffset="+0800" name="Western Standard Time" />
<zoneAbbreviation abbr="WST" utcOffset="+0900" name="Western Summer Time" />
<zoneAbbreviation abbr="X" utcOffset="-1100" name="X-ray Time Zone" />
<zoneAbbreviation abbr="Y" utcOffset="-1200" name="Yankee Time Zone" />
<zoneAbbreviation abbr="YAKT" utcOffset="+0900" name="Yakutsk Time" />
<zoneAbbreviation abbr="YEKT" utcOffset="+0500" name="Yekaterinburg Time" />
<zoneAbbreviation abbr="Z" utcOffset="+0000" name="Zulu Time Zone" />