date 转换为 datetime
from datetime import date
from datetime import datetime
dt = datetime.combine(date.today(), datetime.min.time())
计算昨天日期
from datetime import date, timedelta
(date.today - timedelta(days=1)).strftime("%Y-%m-%d")
local datetime string to utc string
for example, convert beijing time “2023-02-16 10:00:00” to utc time “2023-02-16T02:00:00Z”
from datetime import datetime, timezone
end_time_utc = datetime.strptime(
self.end_time + " +0800", "%Y-%m-%d %H:%M:%S %z").astimezone(
timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")