Java 从“检索当前日期和时间”;禁闭时间“;属性

Java 从“检索当前日期和时间”;禁闭时间“;属性,java,active-directory,Java,Active Directory,在Active Directory中,“锁定时间”属性具有长值。如何从该值计算日期和时间(以便找到用户锁定的时间)?我使用此方法 private final static long DIFF_NET_JAVA_FOR_DATES = 11644473600000L + 24 * 60 * 60 * 1000; Date getDateFromAD(long adLongValue) { long milliseconds = (adLongValue / 10000) - DIFF_N

在Active Directory中,“锁定时间”属性具有长值。如何从该值计算日期和时间(以便找到用户锁定的时间)?

我使用此方法

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;
}

实际上,不需要在DIFF_NET_JAVA_中添加24*60*60*1000来表示日期,这意味着以下内容就足够了

private final static long DIFF_NET_JAVA_FOR_DATES = 11644473600000L;

您可以使用.

Waht about
new Date()
?@Uwe-Allner重复检查结果,它不能生成精确的值这是一个文件时间-也许类似这样的东西会有帮助?