In Active Directory, "lockOutTime" attribute has a long value. How do I calculate the date and time from that value (in order to find at what time the user is locked)?
Asked
Active
Viewed 2,037 times
2
-
1Waht about `new Date(
)`? – Uwe Allner Feb 18 '15 at 07:49 -
@Uwe Allner that does not produce exact value – Anu Feb 18 '15 at 08:29
-
It's a FILETIME - perhaps something like this would help? http://stackoverflow.com/questions/5398557/java-library-for-dealing-with-win32-filetime – Brian Desmond Feb 18 '15 at 21:37
2 Answers
1
I work with this method..
private final static long DIFF_NET_JAVA_FOR_DATES = 11644473600000L + 24 * 60 * 60 * 1000;
Date getDateFromAD(long adLongValue)
{
long milliseconds = (adLongValue / 10000) - DIFF_NET_JAVA_FOR_DATES;
Date date = new Date(milliseconds);
return date;
}

Christian Alvarado
- 21
- 1
0
Actually no need to add 24 * 60 * 60 * 1000 to DIFF_NET_JAVA_FOR_DATES, which means the following is enough,
private final static long DIFF_NET_JAVA_FOR_DATES = 11644473600000L;
You can double check the result with https://www.epochconverter.com/ldap.

nanoart
- 11
- 1
- 1