1.转换为格林尼治时间
(1)转换当前时间
GMT_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
nowtime = datetime.datetime.now()
now_time=datetime.datetime.strftime(nowtime, GMT_FORMAT)
(2)转换某个特定时间(例如,早上八点钟)
GMT_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
oclock =nowtime + datetime.timedelta(hours=- (datetime.datetime.now().hour)+8,minutes=-(datetime.datetime.now().minute),seconds=-(datetime.datetime.now().second))
oclock_8=datetime.datetime.strftime(oclock, GMT_FORMAT)
2.格林尼治时间转换成 xxxx-xx-xx xx:xx:xx
datetime.strftime('%Y-%m-%d %H:%M:%S')