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

View solution in original post

5 REPLIES 5

It works perfect! Thank you so much, Ankur.