获取当前格式化时间:

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

 

获取当前时间戳:

now_timestamp = int(time.time())
格式更改:先转换为时间数组
a = "2013-10-10 23:40:00",
timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S")
timestamp = int(time.mktime(timeArray))
otherStyleTime = time.strftime("%Y/%m/%d %H:%M:%S", timeArray)
otherStyleTime = "2013/10/10 23:40:00"

相关文章:

  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-01-13
  • 2021-05-24
猜你喜欢
  • 2021-06-11
  • 2021-11-28
  • 2021-06-12
  • 2022-12-23
  • 2021-12-06
  • 2021-11-23
相关资源
相似解决方案