Discuss / Python / 交作业

交作业

Topic source

B O O M!

#1 Created at ... [Delete] [Delete and Lock User]

    m = re.match(r'^UTC([\+|\-][\d]{1,2}):00$', tz_str)

    if not m:

        return 0

    hours = int(m.group(1))

    time = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')

    tz_utc = timezone(timedelta(hours=hours))

    time = time.replace(tzinfo=tz_utc)

    return time.timestamp()


  • 1

Reply