m = re.match(r'^UTC([\+|\-][\d]{1,2}):00$', tz_str)
if not m:
return 0
hours = int(m.group(1))
time = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
tz_utc = timezone(timedelta(hours=hours))
time = time.replace(tzinfo=tz_utc)
return time.timestamp()
Sign in to make a reply
B O O M!
m = re.match(r'^UTC([\+|\-][\d]{1,2}):00$', tz_str)
if not m:
return 0
hours = int(m.group(1))
time = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
tz_utc = timezone(timedelta(hours=hours))
time = time.replace(tzinfo=tz_utc)
return time.timestamp()