【发布时间】:2011-07-13 22:25:37
【问题描述】:
我想在 Python 中将当前时间转换为 +0900。
这样做的适当方法是什么(假设在时间模块中)?
我已经阅读了 Python 不包含此内容,您必须使用 pytz 之类的东西。
我不想基于服务器或全局更改它,仅在这个实例中。
【问题讨论】:
-
相关:How do you convert a datetime/timestamp from one timezone to another timezone?。注意:对于 Python 3.9,请使用 zoneinfo。