我运行以下 Java 代码:
TimeZone tz1 = TimeZone.getTimeZone("Etc/GMT-3");
System.out.println(tz1.getDisplayName());
显示为 GMT+03:00
!
似乎当我们使用带有Etc/GMTxx
等id的时区时,符号是反的。为什么 ?
最佳答案
这是 ETC 风格:
http://en.wikipedia.org/wiki/Zoneinfo
The special area of "Etc" is used for some administrative zones, particularly for "Etc/UTC" which represents Coordinated Universal Time. In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed from what most people expect. In this style, zones west of GMT have a positive sign and those east have a negative sign in their name (e.g "Etc/GMT-14" is 14 hours ahead/east of GMT.)
关于java - 时区的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16214066/