我有类似
的长类型1372415991000
我想把它转换成日期对象,快点吗?
答案 0 :(得分:3)
http://docs.python.org/3/library/datetime.html#datetime.date.fromtimestamp
>>> datetime.datetime.fromtimestamp(1372415991000/1000)
datetime.datetime(2013, 6, 28, 19, 39, 51)
答案 1 :(得分:2)
假设它是以毫秒为单位的Unix时间戳:
from datetime import datetime
datetime.fromtimestamp(1372415991000 / 1000)