簡體   English   中英

python如何知道夏令時是否有效?

[英]How does python know if daylight savings time is in effect?

由於某個時區中DST的開始和結束時間每年都會更改,因此python如何判斷dst是否有效?

其實我的舊答案是錯誤的。 在python shell中,您可以執行以下操作:

>>> import time
>>>time.localtime()
here it will show a result
>>> _.tm_isdst

這個問題實際上是重復的,但可以在此處找到舊帖子: Python夏令時

datetime模塊的CPython源代碼的最頂部,它提供了數據源:

“”“具體的日期/時間和相關類型。有關時區和DST數據源,請參見http://www.iana.org/time-zones/repository/tz-link.html 。”“”

大概這可能隨時間變化。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM