转换LDAP AccountExpires为DateTime在C# [英] Convert LDAP AccountExpires to DateTime in C#

查看:609
本文介绍了转换LDAP AccountExpires为DateTime在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想转换LDAP AccountExpires到正常日期时间格式18位字符串。

I want to convert 18 digit string from LDAP AccountExpires to Normal Date Time Format.

129508380000000000 >> 2011年5月26日

129508380000000000 >> May 26 2011

我从使用下面的链接上面的转换。

I got the above conversion from using the following link.

http://www.chrisnowell.com/information_security_tools/date_converter/Windows_active_directory_date_converter.asp?pwdLastSet,%20accountExpires,%20lastLogonTimestamp,%20lastLogon, %20于是%20badPasswordTime

我试图通过使用DateTime.Parse或Convert.ToDateTime转换。但没有成功。

I tried to convert by using DateTime.Parse or Convert.ToDateTime. But no success.

任何人都知道如何将它转换?非常感谢。

Anyone know how to convert it? Thanks very much.

推荐答案

这是1月以来-02-1601。

It's the number of ticks since Jan-02-1601.

DateTime dt = new DateTime(1601, 01, 02).AddTicks(129508380000000000);

这篇关于转换LDAP AccountExpires为DateTime在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆