python3 时区转换

from datetime import datetime
from datetime import timezone
from datetime import timedelta

# 世界标准时间
utc_time = datetime(2019, 7, 30, 7, 50, 0)

# 北京时间UTC+8
cst_time =utc_time.astimezone(timezone(timedelta(hours=-8))).strftime("%Y-%m-%d %H:%M:%S")
原文地址:https://www.cnblogs.com/cooolr/p/11270674.html