【发布时间】:2018-09-08 16:03:31
【问题描述】:
在不知道时区名称的场景下,需要在特定的timezone中获取当前时间。基本上,我需要一个方法来传递UTC 时区的值,并期望返回该区域的当前时间。
我需要的方法应该是`
def get_current_time(utc_value):
#CODE
return current_time
print (get_current_time("+05:30"))`
我希望它应该给我UTC +5:30 时区的当前时间。
怎么做?
【问题讨论】:
-
@iam.Carrot,我想通过字符串传递UTC并获取该区域的时间,我也有解决方案,但如果还有其他方法,请让我知道。
标签: python python-3.x datetime pytz