Python 夏令时

标签 python time dst

如何检查夏令时是否有效?

最佳答案

您可以使用 time.localtime并查看返回值中的 tm_isdst 标志。

>>> import time
>>> time.localtime()
(2010, 5, 21, 21, 48, 51, 4, 141, 0)
>>> _.tm_isdst
0

使用 time.localtime(),您可以在任意时间询问相同的问题,以查看 DST 是否对您当前的时区有效。

关于Python 夏令时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2881025/

相关文章:

javascript - Safari 中的日期显示为使用 Intl.DateTimeFormat 和 en-US 语言环境

javascript - JavaScript 的 Date 对象会自动处理夏令时吗?

python - Arduino 和 Python 通过 UDP 进行通信

javascript - 如何在 JavaScript 中重新格式化时间?

python - pandas 中避免被零除的问题

C++ 结构 : repeat set of functions at a certain time rate

c - 自纪元以来的打印时间(以纳秒为单位)

javascript - Google 脚本日期显示错误 "hours"

python - 如何为mysql不断生成假实时数据?

python - 如何让 stat_smooth 在 ggplot-python 中工作?