在Python下,无法直接通过datetime.datetime.fromtimestamp('131172610187388712')将131172610187388712转换为可读时间,转换方法如下:
t='131172599865898976't_n = long(t)*100/1000000000 #将其从纳秒转换为秒#从1601-01-01 8:00:00到1970-01-01 8:00:00共经过了11644473600秒,所以需要先将其减掉,然后再进行转换print datetime.datetime.fromtimestamp(t_n-11644473600) #返回:2016-09-02 11:19:46print datetime.datetime.fromtimestamp(t_n) #返回2385-09-02 11:19:46
Windows下直接查看时间戳:w32tm /ntte 131172599865898976,返回值:151820 03:19:46.5898976 - 2016/9/2 11:19:46
时间戳计算:
11644473600秒*1000000000 = 11644473600000000000纳秒
转换为活动目录时间戳11644473600000000000纳秒/100纳秒=116444736000000000