I did some "quick-and-dirty" coding to hopefully start you off in the correct direction. This code calculates the actual seconds that have past with a duration. With this, you can then extrapulate the minutes and hour combinations through the use of an integer (because duration is just a 64-bit integer in Navision). Here is the code, hopefully it will help.
------------------------------------------------------------------------------------------------
Globals:
Name DataType
DT1 DateTime
DT2 DateTime
DUR1 Duration
BIGINT1 BigInteger
HOURS Decimal
MINUTES Decimal
SECONDS Decimal
OnRun() Code:
DT1 := CREATEDATETIME(010704D,083000T);
DT2 := CREATEDATETIME(010704D,170000T);
DUR1 := DT2 - DT1;
BIGINT1 := DUR1;
SECONDS := BIGINT1 / 1000;
MINUTES := SECONDS / 60;
HOURS := MINUTES / 60;
ERROR(STRSUBSTNO('%1 second(s) or %2 minute(s) or %3 hour(s) have passed.',SECONDS,MINUTES,HOURS))
------------------------------------------------------------------------------------------------
Hopefully this helps!
Thanks!
Scott Frappier
Ohh well - I hope someone deletes this thread :).
Thanks!
Scott Frappier
------------------------------------------------------------------------------------------------
BIGINT1 := DUR1;
Hopefully this helps!
Thanks!
Scott Frappier
"Vishal" wrote:
> Im in a lil fix here, im sure will find a solution here.....on the boards...heres the problem
>
> Var DT1 Type Datetime
> Var DT2 Type Datetime
> Var Dur Type Duration
>
> D1:=01/07/04 08:30:00
> D2:=01/07/04 17:00:00
>
> Dur := D2 - D1;
>
> which is '8 hours 30 minutes'
>
> now I want to format the value of Dur to Hours:Mins i.e. i want to display 8:30 instead of '8 hours 30 minutes', I tried using the format property, but it gives an error with regards to the stx file...
>
> also wanted to know if there is way to total the duration in a report, like a Group Total.
>
> all suggestions welcome...
> thanx a ton