首页 > 解决方案 > pytz - 时区偏移量与公开信息不一致

问题描述

在解决一个单独的问题时,我发现在 pytz 时区“亚洲/雅加达”的 UTC 偏移量为 7h 7m

为什么是这样?根据我能找到的一切,亚洲/雅加达的偏移量应该只有 7h

import pytz
x = pytz.timezone('Asia/Jakarta')
x._utcoffset
# datetime.timedelta(0, 25620)

25620s = 427 分钟或 7 小时 7 分钟

我错过了什么吗?

标签: pythontimezonetimezone-offsetpytz

解决方案


所以我刚刚看到这个链接
http://pytz.sourceforge.net/#issues-limitations

这导致我访问
http://www.iana.org/time-zones

下载数据并检查我在亚洲文件中找到了这个信息

>     # From Paul Eggert (2014-09-06):
>     # The 1876 Report of the Secretary of the [US] Navy, p 306 says that Batavia
>     # civil time was 7:07:12.5; round to even for Jakarta.

那好吧.....


推荐阅读