[英]How does python know if daylight savings time is in effect?
由于某个时区中DST的开始和结束时间每年都会更改,因此python如何判断dst是否有效?
Actually my old answer was wrong. 其实我的旧答案是错误的。 In the python shell you can do:
在python shell中,您可以执行以下操作:
>>> import time
>>>time.localtime()
here it will show a result
>>> _.tm_isdst
This question is actually a duplicate but the old post can be found here: Python daylight savings time 这个问题实际上是重复的,但可以在此处找到旧帖子: Python夏令时
At the very top of the CPython source code for the datetime
module, it gives the source of the data: 在
datetime
模块的CPython源代码的最顶部,它提供了数据源:
"""Concrete date/time and related types. See http://www.iana.org/time-zones/repository/tz-link.html for time zone and DST data sources. """
“”“具体的日期/时间和相关类型。有关时区和DST数据源,请参见http://www.iana.org/time-zones/repository/tz-link.html 。”“”
Presumably this may be variable over time. 大概这可能随时间变化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.