Python 将时间戳转换为本地时间并进行格式化

在python中,时间戳默认是为格林威治时间,而我们为东八区

使用localtime() 本地化时间戳 使用 strftime() 格式化时间戳

time = time.strftime('%Y%m%d%H%M%S',time.localtime(time.time()))

print(time)

 输出

20180624242613’

猜你喜欢

转载自www.cnblogs.com/lowmanisbusy/p/9220976.html
今日推荐