testss.py 352 B

123456789101112131415161718
  1. import time
  2. tmstm = '2018121810'
  3. timeArray = time.strptime(tmstm,"%Y%m%d%H")
  4. print(timeArray)
  5. print(int(time.mktime(timeArray)))
  6. import datetime
  7. # utc时间
  8. nowutc = (datetime.datetime.utcnow())
  9. print(nowutc)
  10. # dtimeArray = time.strftime(nowutc)
  11. # utc转换时间
  12. timenow = (datetime.datetime.utcnow() + datetime.timedelta(hours=8))
  13. print(timenow)