User Tools

Site Tools


ldap:ad_field_format

Active Directory (AD) date format and conversion

# ldapsearch -L -D ... '(&(objectclass=*)(uid=*))'
dn: CN=MyUser1
whenCreated: 20181220050716.0Z   ==> date
whenChanged: 20220314093553.0Z   ==> date
...
badPasswordTime: 132899094202005830
lastLogoff: 0
lastLogon: 132875084527318818
pwdLastSet: 132917241531383724
accountExpires: 9223372036854775807

accountExpires: 9223372036854775807 =⇒ Never expires (no need to convert)

pwdLastSet =⇒ value in 100 nanoseconds from 1 january 1601

Seconds between 1 january 1601 and 1 january 1970: 11644473600000

Converting this value to EPOCH:

epoch_seconds=((windows_value_100nano)-(11644473600000 * 10000)) /10000000

Once converted to EPOCH, you can use the linux date command like this

date -d@1646642232 +"%Y-%m-%d %H:%M:%S"
ldap/ad_field_format.txt · Last modified: 2022/03/14 14:16 by manu