import datetime
timenow = (datetime.datetime.utcnow() + datetime.timedelta(hours=8)) #将utc时间转化为本地时间
timetext = timenow.strftime('%Y-%m-%d %H:%M:%S')
python获得北京时间时间戳并格式化输出
2020-04-03
import datetime
timenow = (datetime.datetime.utcnow() + datetime.timedelta(hours=8)) #将utc时间转化为本地时间
timetext = timenow.strftime('%Y-%m-%d %H:%M:%S')