def to_timestamp(dt_str, tz_str): time = datetime.strptime(dt_str,'%Y-%m-%d %H:%M:%S') re_zone = re.compile(r'UTC([+|-]\d+):(\d+)') zone = int(re_zone.match(tz_str).group(1)) return time.replace(tzinfo=timezone(timedelta(hours=zone))).timestamp()
Sign in to make a reply
Junhong1994