在C#中将LDAP AccountExpires转换为DateTime

编程入门 行业动态 更新时间:2024-10-11 19:14:34
本文介绍了在C#中将LDAP AccountExpires转换为DateTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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.

www.chrisnowell/information_security_tools/date_converter/Windows_active_directory_date_converter.asp?pwdLastSet,%20accountExpires,% 20lastLogonTimestamp,%20lastLogon,%20and%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);

更多推荐

在C#中将LDAP AccountExpires转换为DateTime

本文发布于:2023-11-09 03:49:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571317.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   中将   AccountExpires   LDAP   DateTime

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!