【问题标题】:how to test if the time is daylight saving or not using command line?如何测试时间是夏令时还是不使用命令行?
【发布时间】:2018-08-25 15:52:20
【问题描述】:

我可以手动检查是否是夏令时。但是有没有办法使用命令行或程序(例如python)来检查这个?

【问题讨论】:

标签: python command-line timezone


【解决方案1】:

对于 Python,发件人: Python daylight savings time

import time  
print(time.localtime().tm_isdst)

根据夏令时返回 0 或 1

对于 CMD 你可以试试:

tzutil /g

Powershell -Command "(Get-Date).IsDaylightSavingTime()"

【讨论】:

    猜你喜欢
    • 2016-10-15
    • 2021-07-17
    • 2013-03-11
    • 2014-04-25
    • 2014-12-17
    • 2012-09-04
    • 1970-01-01
    • 2012-06-26
    • 2013-11-25
    相关资源
    最近更新 更多