Hi,

I'm working with Nav 5 and need to sum Time + Time, but and error is displayed (can't sum Time + Time)...

How can I do it?, it's just 5:00 + 3:00 = 8:00, I can't believe it doesn't work !!

Thanks

In Navision you can subtract datetype time but you can’t sum time datetype. You can only sum an integer to time. Integer it’s the number of milliseconds to increase. You could second time to an integer.

ok, but how do I convert the secondt time to integer?

galletin said:ok, but how do I convert the secondt time to integer?

A small piece of code that takes the actual time, calculates the milliseconds and adds an hours and outputs the result:

v_time[1] := TIME;EVALUATE(v_int[1], FORMAT(v_time[1],0,'<Hours24>'));EVALUATE(v_int[2], FORMAT(v_time[1],0,'<Minutes,2>'));EVALUATE(v_int[3], FORMAT(v_time[1],0,'<Seconds,2>'));v_int[4] := (v_int[1] * 60 * 60 * 1000) + (v_int[2] * 60 * 1000) + (v_int[3] * 1000);EVALUATE(v_time[2], '01:00');v_time[2] += v_int[4];MESSAGE('%1 %2 %3', v_time[1], v_int[4], v_time[2]);

Wow thank you so much, I'll check right now !!!

Hi, I'm working with Nav 5 and need to sum Time + Time, but and error is displayed (can't sum Time + Time)... How can I do it?, it's just 5:00 + 3:00 = 8:00, I can't believe it doesn't work !! Thanks

I can't in my mind concieve of what it means to have 3am plus 5 am, something like saying what is 25 deg C + 22 Deg C, is the correct answer :

47 or 320 or 593.

Since the question poses no logic, all three answers are potentially correct, though in my mind the correct answer would be 320 Deg C.

But if you want to get the number, then the formula is.

NewTime := 050000T + (030000T - 000000T);

So if you want TimeC, the sum of times TimeA and TimeB

TimeDif := TimeA + (TimeB - 000000T);

Now can you explain what you are using this for.

Hi David,

easy... we got an intervention diligence that register the "query time for the client", the "estimated resolution time" and the "resolution time". So I need to calculate quality times in base to that three reference times and other variables, but that's another issue !!.

Have I been clear?

Thanks David !!

OK, so in fact it has nothing to do with adding up times, but adding up durations. I.e you want to know if oneperson worked 3 hours, and one person worked 5 hours, how many hours in total were worked. In which case my formula works so what's the problem?

But keep in mind that time is not really what you want, so when you say "I can't believe Navision can't do that" its not that Navision can't do it. its just that its just not possible what you want.

Imagine a scenario for example where one person works 10 hours, one 8 hours and one 9 hours, that is a total of 27 hours of work, but if you represent it as time, then it will be 3:00AM not really indicative of what you are expecting.

Point is that a time variable is the wrong way to represent this.

You're right David, anyway, at time is enough for me, I'm still starting with "Navision world"

Another thing, I have seen you're an MVP..... I don't know if you can set this thread as "Answered question", I'm logged in but I'm not displayed the combo to end this topic. Thanks !!

how do i convert time in words format!!!!!

a small code i write displays in words as"11 hours" though it is required to be printed as 'eleven hours'...!!!!

any help?!