时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数。

获取一个时间戳

import time
times = time.time()

将一个时间戳格式化为格林威治时间:

gmtimes = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(times))

将一个时间戳格式化为本地时区时间

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

 

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-12-20
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-09
  • 2022-01-26
  • 2021-12-20
  • 2021-11-27
  • 2021-06-15
  • 2021-12-22
相关资源
相似解决方案