Java中的TimeZone ID [英] TimeZone ID's in Java
问题描述
我遇到了java TimeZone的奇怪问题..
I'm having weird problem with java TimeZone..
调用 TimeZone.getDefault()给出了我的本地时区, IDGMT + 02:00。
有趣的是,此ID不会出现在 TimeZone.getAvailableIDs()提供的列表中。显然我的区域似乎是Etc / GMT + 2。
Calling TimeZone.getDefault() gives my local time zone, which has an ID "GMT+02:00". Funny thing is that this ID doesn't appear in a list provided by TimeZone.getAvailableIDs(). Apparently my zone appears to be "Etc/GMT+2".
我正在尝试使用时区填充组合,但是因为GMT而无法进行选择+02:00不在列表中..
有人见过这个问题吗?有什么想法?
I'm trying to populate a combo with time zones, but it's impossible to put a selection because GMT+02:00 is not in the list.. Anyone seen this problem? Any ideas?
更新:
底线是 - 不能依赖ID字符串,必须使用偏移量,因为显示ID可能因系统而异。
The bottom line is - can't rely on ID strings, must go with the offset as display ID's may vary from system to system.
推荐答案
寻找回到其他一些SO问题,这似乎是一个Java-on-Windows问题。请查看这篇文章,特别是答案1,它指向可能解决您的映射问题的维基百科链接。
Looking back on some other SO questions, this seems to be a Java-on-Windows problem. Please have a look at this article, especially answer 1, which points to a wikipedia link that may solve your mapping issue.
这篇关于Java中的TimeZone ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!