首页 技术 正文
技术 2022年11月6日
0 收藏 777 点赞 1,108 浏览 767 个字

(Get-ADUser zhangsan -Properties badpasswordtime).badpasswordtime返回值为:131172610187388712
131172610187388712为长整型时间戳(18位),精确到了纳秒级别。该时间戳是从1601-01-01 8:00:00开始计算
1472791840.74是Linux下的时间戳(默认都是13位),精确到了秒级别。该时间是从1970-01-01 8:00:00开始计算

在Python下,无法直接通过datetime.datetime.fromtimestamp(‘131172610187388712’)将131172610187388712转换为可读时间,转换方法如下:

t=''
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

Python LDAP中的时间戳转换为Linux下时间

时间戳计算:

11644473600秒*1000000000 = 11644473600000000000纳秒
转换为活动目录时间戳
11644473600000000000纳秒/100纳秒=116444736000000000

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,961
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,485
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,330
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,113
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,746
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,780