import time

格式化时间转时间戳

ctime = time.strftime("%Y-%m-%d %H:%M:%S")

先转成struct_time

ctime = time.strptime(ctime, "%Y-%m-%d %H:%M:%S")

再转成时间戳

ctime = time.mktime(ctime)

时间戳转格式化时间

stamp = time.time()

先转成struct_time

stamp = time.localtime(stamp)

再转成格式化时间

ctime = time.strftime("%Y-%m-%d %H:%M:%S", stamp)

相关文章:

  • 2021-08-02
  • 2021-12-05
  • 2021-08-06
  • 2021-10-06
  • 2021-11-04
  • 2021-06-10
  • 2021-12-30
猜你喜欢
  • 2021-06-15
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案