2009-10-06 108 views

回答

5

http://securitythroughabsurdity.com/2005/12/active-directory-and.html

什麼,說,是正確的功能是DateTime.FromFileTime,它返回一個DateTime對象,這是你所需要的東西。

+0

這似乎是工作。 – Christopher 2009-10-06 18:04:10

+0

對於該記錄,也是如此: DateTime root = new DateTime(1601,1,1); DateTime utc = root.AddTicks(timestamp); DateTime local = utc.ToLocalTime(); 返回本地; – Christopher 2009-10-06 18:05:25

+1

其中timestamp是來自AD的INT64值。 另請注意,9223372036854775807的Int64值等於null/no值。 – Christopher 2009-10-06 18:06:11

1

工作下面的例子演示瞭如何使用.NET,這也說明了,你會怎麼做它在C#中做它在PowerShell中:

$timestamp=129699324000000000 
[System.DateTime]::FromFileTime($timestamp) 

Monday, January 02, 2012 12:00:00 AM