Discuss / Python / 新手打卡

新手打卡

Topic source

邹lh

#1 Created at ... [Delete] [Delete and Lock User]
def to_timestamp(dt_str, tz_str):
    value = re.match(r'^(UTC)([\+\-\d]+)(:00)$',tz_str)
    dt_2 =datetime.strptime(dt_str,"%Y-%m-%d %H:%M:%S").replace(tzinfo = timezone(timedelta(hours = int(value.group(2)))))
    return dt_2.timestamp()
    pass

  • 1

Reply