def to_timestamp(dt_str, tz_str):
#转化为时间 dt = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
#加入时区信息 m = re.search(r'[+-]\d+', tz_str).group(0) print(m) tz_utc = timezone(timedelta(hours=int(m))) dt = dt.replace(tzinfo=tz_utc)
#转化为时间戳 return dt.timestamp()
Sign in to make a reply
蓝萨节
def to_timestamp(dt_str, tz_str):
#转化为时间 dt = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
#加入时区信息 m = re.search(r'[+-]\d+', tz_str).group(0) print(m) tz_utc = timezone(timedelta(hours=int(m))) dt = dt.replace(tzinfo=tz_utc)
#转化为时间戳 return dt.timestamp()