Tag: country

有没有办法用(仅)国家代码(有效的ISO-3166代码)获得时区?

我正在尝试为用户获取TimeZone。 为此,我有一个国家代码,这是一个有效的ISO国家代码。 这些代码是ISO-3166定义的大写双字母代码。 您可以在多个站点找到这些代码的完整列表,例如: http : //www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html 我认为回应是“不,因为这是一个多方面的关系……像美国这样的国家可能有很多时区……”。 那就是问题所在… 我尝试过类似的东西: //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 […]