import time import datetime time='Friday, November 18, 2016' time_format=datetime.datetime.strptime(time,'%A, %B %d, %Y') #datetime.datetime(2016, 11, 18, 0, 0) datetime.datetime.strftime(time_format, '%Y-%m-%d %H:%M:%S') #'2016-11-18 00:00:00' datetime.datetime.utcnow() datetime.datetime.utcnow() + datetime.timedelta(days=7) (datetime.datetime.utcnow() + datetime.timedelta(days=7)).isoformat() datetime.datetime.utcnow().isoformat() a = 1567818003 from datetime import datetime #轉化utc時間 datetime.utcfromtimestamp(a) ##### datetime.datetime(2019, 9, 7, 1, 0, 3) datetime.utcfromtimestamp(a).isoformat()
附:code