testss.py 472 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,time
  7. nowutcdatetime = datetime.datetime.utcnow()
  8. un_time = time.mktime(nowutcdatetime.timetuple())
  9. print(un_time)
  10. # utc时间
  11. # print(datetime.datetime.fromtimestamp(1545868858))
  12. # dtimeArray = time.strftime(nowutc)
  13. # utc转换时间
  14. # timenow = (datetime.datetime.utcnow() + datetime.timedelta(hours=8))
  15. # print(timenow)