Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 08:31 AM
I am trying to calculate the end date using start date + duration but I am struggling as the duration is 01-01-1970 it is giving me the seconds since then and I can't add them to the Start date to get the end date. Any help would be much appreciated..
Solved! Go to Solution.
Labels:
- Labels:
-
Scripting and Coding
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 08:34 AM
Hi,
you can use this script to add duration to start date
something like this in server side
var gdt = new GlideDateTime(current.start_date.getDisplayValue());
var ms = current.u_dation.dateNumericValue();
gdt.add(ms);
current.end_date = gdt.getValue();
Regards
Ankur
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 06:29 AM
It works perfect! Thank you so much, Ankur.