how to add duration field to today date and time

rakhi1234
Kilo Contributor

i have duration field i am geeting 5days 2hr 50min 20 sec i want to add this duration to gs.nowdateandtime()./finall i want todaydate +5days 2hr 50min 20 sec,

5 REPLIES 5

anurag92
Kilo Sage

Yes, for this you can try getting the numeric value of delivery time and then add in now time. Try this:



var durationTotal = (current.variables.u_delivery_time.getGlideObject().getNumericValue())/1000;



var todayDateTime=new GlideDateTime();


var finalDuration = todayDateTime.addSeconds(durationTotal);



finalDuration is the result that you require.



Let me know if this works.