def to_timestamp(dt_str, tz_str): tz = re.match(r'^UTC([+-]\d{1,2})',tz_str).groups()[0] ts = datetime.strptime(dt_str,'%Y-%m-%d %H:%M:%S').replace(tzinfo=timezone(timedelta(hours=int(tz)))) return ts.timestamp()
Sign in to make a reply
船长杰克