def to_timestamp(dt_str, tz_str): try: m = re.match(r'UTC([+-]\d{1,2}):00', tz_str) tzinfo = timezone(timedelta(hours=int(m.group(1)))) return datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S').replace(tzinfo=tzinfo).timestamp() except Exception as e: print(e) return None
Sign in to make a reply
苏生不语_