Python中的时间相关库有:
datetimetime

主要形式有:

  • datetime
  • timestamp

相互转换:

timestamp->datetime: dt = datetime.datetime.utcfromtimestamp(timestamp)
datetime->timestamp:

dt=datetime.datetime(2016, 9, 26, 7, 4, 32, 20593)
t=dt.timetuple()  
timeStamp = int(time.mktime(t)) 

时间或日期的格式问题,可以使用strftime

涉及到时区等问题,参考:

  1. python timestamp和datetime之间的转换:http://blog.csdn.net/xxm524/article/details/48055275
  2. Python中实现对Timestamp和Datetime及UTC时间之间的转换: http://www.jb51.net/article/63654.htm

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-07-21
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2021-12-05
  • 2021-12-05
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案