Converting from LDAP Active Directory Filetime format into glide.DateTime?

mcrib
Mega Expert

Trying to convert from an LDAP import using a transform into a ServiceNow DateTime field. Doing so if in "UNIX time" is easy using setNumericValue, but this doesnt work on AD "Filetime" 18-digit formatting.   Has anyone run into this before and been able to transform? I don't see a built-in function in SN and looking on the web hasn't yieled anything either.

Thanks.

1 ACCEPTED SOLUTION

mcrib
Mega Expert

Well I figured it out.. if anyone has the same issue in the future here's the answer (can be pasted into Scripts - BG.. you'll need to convert it a bit for the field variables on the transform script):



var gdt = new GlideDateTime();


var mstime = (130997660145165200);


gdt.setNumericValue((mstime - 116444736000000000)/10000);


gs.print(gdt.getValue());


gs.print(gdt.getNumericValue());


View solution in original post

5 REPLIES 5

mcrib
Mega Expert

I should mention that 116444736000000000 is epoch time big bang - 01/01/1970 00:00:00 UTC