We have fetched the 'pwdLastSet' AD attribute in IDM through Px Policy LDAP Query filter. The output received is in 18 digit LDAP Timestamp (default datatype).
I need to convert this timestamp to a regular Date and Time and store in IDM.
Release : 14.3
Component : Identity Manager, PX Policy
The below is provided as is and out of the scope of L1 support. This would return yyyyMMdd format.
function init(ScreenContext){
var adPwdLastChange = ScreenContext.getFieldValue("PasswordLastSet");
var dateInIMFormat= (adPwdLastChange - 116444736000000000) / 10000;
var pwdate = new Date(Math.round(dateInIMFormat));
var pwdExpiryDate = pwdate.getDate();
pwdate.setDate(pwdExpiryDate+90);
var sdf = new java.text.SimpleDateFormat("yyyyMMdd");
ScreenContext.setFieldValue("PasswordExpiryDate",sdf.format(pwdate));
}