def to_timestamp(dt_str, tz_str): symbolnum = re.match(r'UTC([\+\-])(\d+?)\:\d+', tz_str).groups() my_hours = symbolnum[0].lstrip('+') + symbolnum[1] tz_utc = timezone(timedelta(hours = int(my_hours))) cday = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S') dtnow = cday.replace(tzinfo = tz_utc) return dtnow.timestamp()
Sign in to make a reply
用户0520746251