def to_timestamp(dt_str, tz_str):
dt_dat=datetime.strptime(dt_str,'%Y-%m-%d %H:%M:%S')
tmp=re.compile(r'(.\d+):')
tz_dat=int(tmp.findall(tz_str)[0])
tz_dat=timezone(timedelta(hours=tz_dat))
dt_dat=dt_dat.replace(tzinfo=tz_dat)
return dt_dat.timestamp()
Sign in to make a reply
你眼训可以走先JIA
def to_timestamp(dt_str, tz_str):
dt_dat=datetime.strptime(dt_str,'%Y-%m-%d %H:%M:%S')
tmp=re.compile(r'(.\d+):')
tz_dat=int(tmp.findall(tz_str)[0])
tz_dat=timezone(timedelta(hours=tz_dat))
dt_dat=dt_dat.replace(tzinfo=tz_dat)
return dt_dat.timestamp()