通过提供时区值获取不同时区的当前时间

Getting current time of different timezone by providing timezone value

在不知道时区区域名称的场景下,需要获取特定timezone中的当前时间。基本上,我需要一种方法,我将传递时区的 UTC 值并期望 return 作为该区域的当前时间。 我需要的方法应该是`

def get_current_time(utc_value):
    #CODE
    return current_time
print (get_current_time("+05:30"))`

我希望它能给我 UTC +5:30 时区的当前时间。 怎么做?

from pytz import all_timezones, timezone
from datetime import datetime

def get_cuurent_time(utc_value):
    for zone in all_timezones:
        tz = timezone(zone)
        if utc_value in  str(datetime.now(tz)):
            return datetime.now(tz)
print (get_cuurent_time("+05:30"))

我做到了,麻烦不要:),如果还有其他方法,请告诉我。