有没有一种优雅的方式在另一个时区显示当前时间?
我想要一件具有以下一般精神的东西:
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')>))
一种方法是,通过C库的时区设置
一种更简单的方法:
您可以使用pytz库:
相关问题 更多 >
编程相关推荐