有没有一种优雅的方式来显示另一个时区的当前时间?
我想拥有一般的精神:
cur = <Get the current time, perhaps datetime.datetime.now()>
print("Local time {}".format(cur))
print("Pacific time {}".format(<something like cur.tz('PST')>))
print("Israeli time {}".format(<something like cur.tz('IST')>))
Run Code Online (Sandbox Code Playgroud) 我正在使用datetime模块来生成当前日期.但是,当我在晚上7点之后运行时,当前日期变为明天的日期.
我不确定如何为以下模块设置时区
from datetime import *
print date.today()
Run Code Online (Sandbox Code Playgroud)
我已经阅读了文档,但还没有找到如何设置它.