Powershell: Convert 18-digit LDAP/Win32 Epoch timestamp to DateTime object


LDAP use a 18 digit timestamp format. It’s an epoch timestamp.

To convert it to an DateTime Object use the following function

$MyDate=(Get-Date 01.01.1601).AddSeconds(132907192451438148/1000000/10)
Wednesday, 2. March 2022 18:27:25

Explaintation: The epoch timestamp are 100-nanosecond intervals since 1. January of 1600. Therefore Devide it through 10 then you get the microseconds, devide it through 1000000 then you get the seconds.


Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.