python - SetSystemTime 总是根据时区添加小时

标签 python systemtime

import win32api
win32api.SetSystemTime (timetuple[0], timetuple[1], 
timetuple[6],timetuple[2], timetuple[3], timetuple[4], timetuple[5], 0)

我使用此代码来更改 Windows 上的系统时间。但是当我运行此代码时,它会自动添加 +8 小时或根据计算机中设置的时区。如何在不添加时区的情况下设置时间?

谢谢

最佳答案

根据 MSDN:

SetSystemTime function

Sets the current system time and date. The system time is expressed in Coordinated Universal Time (UTC).

您应该使用SetLocalTime如果您想使用计算机的默认时区,请使用此函数。

关于python - SetSystemTime 总是根据时区添加小时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21717741/

相关文章:

python:用另一个列表中的项目替换列表中的项目

java - 如何在java中获取系统日期和时间格式?

更改计算机时钟后的 Java 系统时间

python - 替代已弃用的 sqlite pragma "default_cache_size"

python - 在 python 和 Glade 中使用复选框

java - Apache pulsar : Error Checking/Getting Partition Metadata while Subscribing

C++ 系统时间返回相同的错误值

c++ - std::chrono 中是否有设施来协助注入(inject) system_clock 进行单元测试

c++ - 如何使用boost在C++中实现独立于系统时间的定时器回调

python - 如何使用 Selenium 和 Python 处理 try 循环中的错误