testss.py 315 B

1234567891011121314151617
  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. # utc转换时间
  11. timenow = (datetime.datetime.utcnow() + datetime.timedelta(hours=8))
  12. print(timenow)