将当前时间转成格林威治时间:
from datetime import datetime, timedelta
import random
local = datetime.now() + timedelta(sencods = random.random())
b = datetime.stftime(local, "%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z"
b: 即为当前时间在加上秒数之后的格林威治时间
将类似格林威治时间的字符串经过处理转成格林威治时间:
from datetime import datetime, timedelta
import random
date_ = datetime.strptime(start_time, "%Y-%m-%dT%H:%M:%S.%fZ")
local_time = date_ + timedelta(milliseconds=random.random())
start_time = datetime.strftime(local_time, "%Y-%m-%dT%H:%M:%S.%f")[:-3] + 'Z'
start_time:即为处理过的格林威治时间