How can I convert LDAP Timestamps in Libra Office to a date time format

0

If I query the directory, I get the following results.

ldapsearch2.4 -x -b "dc=localhost,dc=com" "cn=auser" "+" | grep stamp
createTimestamp: 20100407122221Z
modifyTimestamp: 20100407122221Z
createTimestamp: 20100407122436Z
modifyTimestamp: 20111229151358Z

I am pulling the directory into an spread sheet so we can perform an audit on our list of users. The current date stamp is not simple to convert into a spread sheet understandable date time object.

This helped me understand how the actual date is stored but I still need a way to convert it. http://www.novell.com/coolsolutions/qna/6668.html

This will return Greenwich Mean Time (GMT) in the following format: yyyymmddhhmmssZ

nelaaro

Posted 2012-06-29T12:02:13.417

Reputation: 9 321

Answers

1

With the following value in A2

20100407122436Z

I can use the formulae to convert into a date time object that Libra Office understands.

=DATE(MID(A2,1,4),MID(A2,5,2),MID(A2,7,2)) + TIME(MID(A2,9,2),MID(A2,11,2),MID(A2,13,2))

Which is stored as Libra office epoch floating point number

40275.5170833333

With date formatting on the result It shows up as

2010/04/07 12:24:36

I am not using the time zone information as I don't have users accross different time zones in the directory. You can pull the time zone using the following formulae

=RIGHT(A2,1)

Now I can sort by date all the user information I pulled from LDAP.

nelaaro

Posted 2012-06-29T12:02:13.417

Reputation: 9 321

Excellent. Ensure that the conversion cell supports the entire generalized time syntax as defined in rfc4517.

– Terry Gardner – 2012-06-30T09:32:18.353

@TerryGardner, the time syntax can be set by the format options proved by office. Libra Office simply stores it a long int, http://help.libreoffice.org/Common/Number_Format_Codes.

– nelaaro – 2012-07-02T08:12:35.830