本文介绍了Python夏令时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查夏令时是否有效?
How do I check if daylight saving time is in effect?
推荐答案您可以使用 time.localtime 并查看 tm_isdst 标志。
>>> import time >>> time.localtime() (2010, 5, 21, 21, 48, 51, 4, 141, 0) >>> _.tm_isdst 0使用 time.localtime(),您可以在任意时间问相同的问题,以了解DST在当前时区是否有效。
Using time.localtime(), you can ask the same question for any arbitrary time to see whether DST would be (or was) in effect for your current time zone.
更多推荐
Python夏令时
发布评论