 DateTime, Date and Time so crazy !!

Hi developers,

the quiz is that I have four references, date and time required (dR and tR), date and time of intervention (dI and tI).

I calculate the diference between them (dDif = dI - dR and tDif = tI and tR), so now I know how many days (dDif) and time (tDif) wasted from request to intervention separately.

I calculate now the diference between them creating datetimes (dTotal := CREATEDATETIME(dR,tR) - CREATEDATETIME(dI,tI). Now I got the duration between request and intervention, for example 1 day, 20 hours and 15 minutes.

But the problem is that now I need to subtract for each day (dDif) 13 hours. All this is to calculate quality times with customers, the subtract is because I don’t have to include the time the corporation is closed (13 hours per day).

Any suggestion? [:S]

Thanks !!!

Isn’t there a duration data type that you can use for this?

dt1 := currentdatetime;
dt2 := currentdatetime - 1000000000;
intDays := (dt1 - dt2) div (24 * 3600 * 1000);
message(’%1%2 days’,dt1-dt2,intdays);

dt1,dt2 are datetime

intDays is an integer

Hi kriki and everybody,

now FORM.RUN topic is closed, thanks a lot… I don’t understand good the expression below (div (24 * 3600 * 1000) but can you tell me how to subtract 13 hours to a datetime var? [:)]

With this you don’t need to subtract the 13 hours.

The expression does this : it takes the difference between 2 datetimes as a biginteger and then divides this by a number to get the number of days between them.

DIV (24 * 3600 * 1000) means divide by the product of 24 hours/day with 3600 seconds/an hour and 1000 milliseconds/second.

It seem I was so “full” on Friday. Working good today [:D]

Thanks kriki !