将国家/地区代码转换为Java中的时区 [英] Convert country-state code to time zone in Java
本文介绍了将国家/地区代码转换为Java中的时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将国家/地区代码作为输入,是否可以使用Java获取时区?例如 us-tx->(GMT-6)
尝试使用
您可以在此地图上清楚地看到许多州的时区边界未遵循州边界.
Having country-state code as input, is it possible to get the timezone using Java?
For example us-tx -> (GMT-6)
Tried using this answer, however this method uses only the country code, without the state and the output is :
US/Alaska_US/Aleutian_US/Arizona_US/Central_US/East-Indiana_US/Eastern_US/Hawaii_US/Indiana-Starke_US/Michigan_US/Mountain_US/Pacific_US/Pacific-New_US/Samoa
解决方案
This isn't possible - in any language. Many US states have more than one time zone, depending on which part of the state you are referring to:
You can clearly see on this map, many states where the time zone boundary does not follow the state boundary.
这篇关于将国家/地区代码转换为Java中的时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文