纪元时间到日期时间的转换 python
epoch time to datetime conversion python
我正在使用 python 3.6.2 并尝试使用以下方法将纪元转换为日期时间,
creation_date=time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch)
我收到以下错误,
OSError: [Errno 22] Invalid argument
“1535539535018”失败。
你应该确保你的纪元时间以秒为单位:
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1535539535018/1000))
我正在使用 python 3.6.2 并尝试使用以下方法将纪元转换为日期时间,
creation_date=time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch)
我收到以下错误,
OSError: [Errno 22] Invalid argument
“1535539535018”失败。
你应该确保你的纪元时间以秒为单位:
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1535539535018/1000))