- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 01:24 AM
Hi,
I want to convert a long integer to Date/time.
In LDAP I have a field called accountexpires. The field type is long Integer.
In the User table, I have field called End Date. The field type is Date/Time.
I want to map accountexpires with End Date.
Can anyone help me?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 08:28 AM
if my answer helped you, kindly mark it as ✅ Correct & 👍Helpful so that it does not appear in unanswered list & close the thread.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 01:37 AM
Hi,
Please go through below link it might help you.
Please mark Helpful and Correct based on impact.
Regards
Nikhil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 01:40 AM
Hi Sriram,
Can you try using below in the field map for the LDAP transform.
var gdt = new GlideDateTime();
gdt.subtract(gdt.getNumericValue());// gets the date to 0
gdt.add(source.yourintegerfield);// no quotes required
target.field_name=gdt.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 01:57 AM
Hi Sriram,
Sample script below; ensure you use proper source and target fields
you can use this in your onBefore transform script
var dtUtil = new DateTimeUtils();
target.u_end_date = dtUtil.int8ToGlideDateTime(source.u_ad_date);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 02:03 AM
Hi,
Yes, you can convert it, Please try below script :
var gdt = new DateTimeUtils();
target.field_name = gdt.int8ToGlideDateTime(source.field_name);
If my answer helped you in any way, please then mark it as helpful/correct.
Kind regards,