{"id":9356,"date":"2023-07-04T22:38:51","date_gmt":"2023-07-04T20:38:51","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=9356"},"modified":"2024-07-23T22:59:31","modified_gmt":"2024-07-23T20:59:31","slug":"powershell-convert-18-digit-ldap-timestamp-to-datetime-object","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/powershell-convert-18-digit-ldap-timestamp-to-datetime-object\/","title":{"rendered":"Powershell: Convert 18-digit LDAP\/Win32 Epoch timestamp to DateTime object"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_9356 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_9356')){$('.twoclick_social_bookmarks_post_9356').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Powershell%3A%20Convert%2018-digit%20LDAP%2FWin32%20Epoch%20timestamp%20to%20DateTime%20object\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0ALDAP%20use%20a%2018%20digit%20timestamp%20format.%20It%27s%20an%20epoch%20timestamp.%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/powershell-convert-18-digit-ldap-timestamp-to-datetime-object\\\/\",\"post_id\":9356,\"post_title_referrer_track\":\"Powershell%3A+Convert+18-digit+LDAP%2FWin32+Epoch+timestamp+to+DateTime+object\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>LDAP use a 18 digit timestamp format. It&#8217;s an epoch timestamp.<br \/>\n<!--more--><br \/>\nTo convert it to an DateTime Object use the following function<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$MyDate=(Get-Date 01.01.1601).AddSeconds(132907192451438148\/1000000\/10)\r\n$MyDate\r\nWednesday, 2. March 2022 18:27:25\r\n<\/pre>\n<p>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.<\/p>\n<p>Michael <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, LDAP use a 18 digit timestamp format. It&#8217;s an epoch timestamp.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[344,5],"tags":[450,1984,1982,133,1983],"class_list":["post-9356","post","type-post","status-publish","format-standard","hentry","category-powershell-scripting","category-windowsknowhow","tag-convert","tag-datetime","tag-epoch","tag-powershell","tag-timestamp"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=9356"}],"version-history":[{"count":4,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9356\/revisions"}],"predecessor-version":[{"id":9358,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9356\/revisions\/9358"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=9356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=9356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=9356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}