def to_timestamp(dt_str, tz_str):
utc = int(re.search(r'([\+\-]\d+)', tz_str).group(1))
dt = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
st = dt.replace(tzinfo=timezone(timedelta(hours=utc))).timestamp()
return st
Sign in to make a reply
银发的index
def to_timestamp(dt_str, tz_str):
utc = int(re.search(r'([\+\-]\d+)', tz_str).group(1))
dt = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
st = dt.replace(tzinfo=timezone(timedelta(hours=utc))).timestamp()
return st