# how to add two duration

Hi Expert,

I had manage to poplute the duration for all my tasak ticket. now I'm trying to sum up the total duration taken by all the task, please advice how to do it?

I'm using

date1 = Math.floor( (new Date( starttime ).getTime()) /1000);
date2 = Math.floor((new Date( endtime ).getTime())/1000);
duration = system.functions.val((date2- date1), 3);

which return me value of dd hh:mm:ss

now I need to sum all these together but when I try system.functions.val(duration,1) it a null value

Regards

Soong

• Where do you use this ?

• Hi,

I'm using this in my request ticket,  on initial, it will check the list of task related to the ticket.  then get the duration of each task ticket and store into a temp array ( let call it duration). then I do a for loop.

var totalduraton = 0;

for(i=0;i<duration.lenght();i ){

totalduration= totalduration duration[i];

}

• Task ticket - you mean line item - OCML table ?

And you need to calculate the total duration of all Line items for one request ?

• Task ticket - you mean line item - OCML table ?

And you need to calculate the total duration of all Line items for one request ?

• Task ticket - you mean line item - OCML table ?

And you need to calculate the total duration of all Line items for one request ?

• Hi,

Sorry, don't quite understand about hte line item. What I'm trying to do is, to sum up all the task duration.

Example: I had a request ticket RF123, in this ticket there is 3 task RFT1 , RFT2, RFT3.

RFT1 from open to close took 3 01:30:00

RFT2 from open to close took 5 01:30:00

RFT3 from open to close took 08:30:00

So after all the task ticket is close, when it move to the review phase. I had a field total duration. which should show the total duration taken by all 3 task which in this example should be 8 day 11 hour and 30 min (8 11:30:00), I was able to calucalete the time different for each task, but I having problem summing up the duration.

Regards

Soong

• Where are you summing it up? And from where are you updating? In other words, SM is communicating with which tool for computation and updates.

• Hi,

I'm summing it up in a ruleset which i put in the entry of the review phase.

there is not tool, I just want the sum of total duration of all task in the request ticket

Regards

soong wengchew