在研究时区的过程中,我发现了GeoNames论坛上这篇有趣的帖子: (链接)。
这已经不是我第一次看到
我的目标是利用原始偏移量建立一个时区下拉菜单,显示每组城市的UTC偏移量。现在我列出时间区域的所有转换,并使用非夏令时偏移量,但我上面提到的帖子指出,在南半球这是错误的。
rawOffset gives the fixed timezone.
dstOffset gives the civil time offset from GMT on July 1st
gmtOffset gives the civil time offset from GMT on January 1st
例如在南半球的智利 (http://ws.geonames.org/timezone?lat=-33.46912&lng=-70.641997),我们有以下数值:
rawOffset = -4 indicating the timezone
dstOffset = -4
gmtOffset = -3, which means that daylight saving time is in use in January.
例如,在北半球的荷兰地区 (http://ws.geonames.org/timezone?lat=51.589322&lng=4.774491):
rawOffset = 1
dstOffset = 2
gmtOffset = 1, indacting that daylight saving time is in use in July.
这已经不是我第一次看到
rawOffset
了,这个SO答案(Java语言)也依赖它。我的目标是利用原始偏移量建立一个时区下拉菜单,显示每组城市的UTC偏移量。现在我列出时间区域的所有转换,并使用非夏令时偏移量,但我上面提到的帖子指出,在南半球这是错误的。
编辑: http://download.oracle.com/javase/1.4.2/docs/api/java/util/TimeZone.html#getRawOffset%28%29
来自GeoNames的Marc告诉我,他们通过使用该Java方法获得原始偏移量。
任何Java专家知道他们是如何做到的吗?或者我可以在哪里浏览getRawOffset()
的源代码?
有什么办法可以在PHP中获取原始偏移量吗?
DateTimeZone::getTransitions()
,但它只返回一个带有偏移量和另一个布尔字段(isdst
)的字段,我不认为我可以从中找出原始偏移量。 - Alix Axel