LDAP Dates Converted

|

Dates that look like 127524839567199000 (pwdLastSet, accountExpires, lastLogonTimestamp, etc.)

IF(
	B16>0
	,B16/864000000000 - 109205
	,""
)

Example: 130186556607343750 converts to 40921.80861
40921.80861 in Excel with cell formatting of Date/Time will show as January 13th, 2012 7:24 PM

Dates that look like 20050210223453.0Z (whenChanged)

DATEVALUE(
	CONCATENATE(
		(LEFT(TRIM(B9),4))
		,"-"
		,(RIGHT(LEFT(TRIM(B9),6),2))
		,"-"
		,RIGHT(LEFT(TRIM(B9),8),2)
	)
)
+
TimeValue(
	CONCATENATE(
		RIGHT(LEFT(TRIM(B9),10),2)
		,":"
		,RIGHT(LEFT(TRIM(B9),12),2)
		,":"
		,RIGHT(LEFT(TRIM(B9),14),2)
	)
)

Example: 20080523192311.0Z in Excel with cell formatting of Date/Time will show as 7/18/2013 9:14 PM

Source: http://maxvit.net/convert_ldap_dates

Originally Posted on July 25, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.