Gibt es eine Möglichkeit, um eine Zeitzone mit (nur) einem Länder-code (Gültiger ISO-3166-code)?

Ich versuche, eine Zeitzone für einen Benutzer.

Dafür habe ich eine country code ist eine gültige ISO-Land-Code. Diese codes sind die upper-case -, zwei-Buchstaben-codes gemäß ISO-3166. Sie finden eine vollständige Liste dieser codes an einer Vielzahl von Standorten, wie zum Beispiel:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

Ich denke, die Antwort ist "Nein, weil es eine manytomany Beziehung... es kann viele Zeitzone für ein Land wie die USA ...". Das ist das problem...

Habe ich tryied etwas wie:

//CountryEnum contains ISO_3166 values (http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html) 
  //List all country to test timezone:
  for (int i = 0; i < CountryEnum.values().length; i++) {
   String isoCountryCode = CountryEnum.values()[i].name();//Get the iso country code
   Locale locale = new Locale(isoCountryCode);//Build a country specific locale
   Calendar calendar = Calendar.getInstance(locale);//Build a calendar with the specific locale
   String timeZone = calendar.getTimeZone().getDisplayName();//Build a timeZone with the calendar
   System.out.println("LOCALE : "+locale+" /COUNTRY: "+isoCountryCode+" /TIMEZONE: "+timeZone);
  }

Aber es immer wieder server-Zeitzone ...

Irgendwelche Ideen ?

InformationsquelleAutor der Frage ajeanson | 2009-09-07

Schreibe einen Kommentar