def to_timestamp(dt_str, tz_str):
cday = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
offset=int(re.match(r'^UTC([+|-]\d+):\d{2}$',tz_str).group(1))
return cday.replace(tzinfo=timezone(timedelta(hours=offset))).timestamp()
Sign in to make a reply
灿_Clarence
def to_timestamp(dt_str, tz_str):
cday = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
offset=int(re.match(r'^UTC([+|-]\d+):\d{2}$',tz_str).group(1))
return cday.replace(tzinfo=timezone(timedelta(hours=offset))).timestamp()