【问题标题】:How to get the timezone offset for the known timezone string?如何获取已知时区字符串的时区偏移量?
【发布时间】:2015-05-18 11:54:04
【问题描述】:

我正在使用 pygeoip 包来获取 IP 的时区,

>>> import pygeoip
>>> gi = pygeoip.GeoIP('GeoIPCity.dat')
>>> gi.time_zone_by_addr('64.233.161.99')
'America/Los_Angeles'

是否有任何软件包可以提供时区为
PST UTC -8:00 America/Los_Angeles
或者有什么类似的内容?

【问题讨论】:

    标签: python datetime time timezone geoip


    【解决方案1】:

    我认为 pytz 库是您需要的:http://pytz.sourceforge.net/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 2019-04-08
      • 1970-01-01
      • 2021-04-11
      • 2019-11-07
      • 2015-02-02
      相关资源
      最近更新 更多