Hi everybody,
I'm trying to get a TimeZone for a user.
For this I have a country code which is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.chemie.fu-berlin.de/diverse/doc/ISO%5F3166.html
I think the response is "no because it's a manytomany relationship... there can be many timezone for a country like USA ...". That's the problem...
I've tryied something like:
//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);
}
But it always return server TimeZone ...
Any ideas ?