Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Calculate end date using start date + duration

Jake Sadler
Kilo Sage

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..

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

It works perfect! Thank you so much, Ankur.