Skip to main content

We need to sync accountExpires date field from AD in usr_flag2 field of contact user. I am able to sync the data but the data seems to be in datetime or other format.  

For example expiry date for a user is set Monday June 3,2024 in AD but when i run the CUG process the value it updates in usr_flag2 field is 1336194720. How can I update the field with proper date format? 

 

 

 

Hi, Without knowing how your updating the contact user (e.g. ETM) I cant give you specific guidance, but the 10 digit number looks like a date in Unix Time format. 

You would need to convert that into a “traditional” date format and it should appear as you wish. 


Hi Kevin:

Thanks for the reply, i doubt that its a date in Unix Time Format beause when I convert the value 1336194720 to date time format it gives me value Sat May 05 2012 01:12:00 but the actual value is Monday June 3,2024.

This is how I am updating the contact user

  1. Account Expires field is set in attributes section in ldap query

attributes = {
        "objectGUID",
        "sAMAccountName",
        "givenName",
        "sn",
        "cn",
        "title",
        "department",
        "subDepartment",
        "l",
        "accountExpires",
    },

 

  1. usr_flag2 value is set with accountExpires attribute.

 

usr {
    KEY = es objectGUID ]],

    usr_flag2=/p accountExpires ]],
   
}


Looks like LDAP dates might use Jan 1, 1601 UTC as the epoch. 

https://www.epochconverter.com/ldap tells me that 133619472000000000 is Tuesday, 4 June 2024 04:00:00 UTC, which could be the correct value (depending on the timezone of your server).


Thanks @Paul McCulloch , I was able to resolve it using the below line of code which might be helpful for others following up this thread. 

usr_flag2=2= local time
                 time1= ((accountExpires/10000000)- 11644473600)                      
                  time = os.date("%x", tostring(time1))
                 return time
        
    ]],

 

Reference page: python - Convert 18-digit LDAP/FILETIME timestamps to human readable date - Stack Overflow


Reply