- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 09:08 AM
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.
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 12:35 PM
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());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 09:22 AM
Can you share an ex of the filetime?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 09:25 AM
Sure. AD has it listed as 130997660145165200 in one example, which should translate to 2016-02-12 15:53:35 GMT in YYYY-MM-DD format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 10:43 AM
I should also mention that Filetime is the intervals of 100-nano seconds since JAN 01 1601
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 12:35 PM
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());
