Time Duration Format

jpjesus
Member Posts: 45
Hi,
I am trying to create a dialog box where I can show an estimation on how long it will take to performe a task. In this case, I know it might take a long time so I want to give the user an idea on how long it will take.
The real problem is when I want to represent the duration in this notation: hh:mm:ss.
I know that the formula time1 minus time2 (dur := time1 - time2) results in a duration value.
I can show it with its basic notation. For example: '1 minute 10 seconds 136 milliseconds'
What I would like to do is show it as: 00:01:10 (hh:mm:ss).
I've tried to use the format function but it doesn't work:
FORMAT(durRemaining,0,'<Hours24,2>:<Minutes,2>:<Seconds,2>')
I get the error: Internal Error 47-1. It has something to do with the fin.stx file.
Any help is welcome.
Cheers,
Joao
I am trying to create a dialog box where I can show an estimation on how long it will take to performe a task. In this case, I know it might take a long time so I want to give the user an idea on how long it will take.
The real problem is when I want to represent the duration in this notation: hh:mm:ss.
I know that the formula time1 minus time2 (dur := time1 - time2) results in a duration value.
I can show it with its basic notation. For example: '1 minute 10 seconds 136 milliseconds'
What I would like to do is show it as: 00:01:10 (hh:mm:ss).
I've tried to use the format function but it doesn't work:
FORMAT(durRemaining,0,'<Hours24,2>:<Minutes,2>:<Seconds,2>')
I get the error: Internal Error 47-1. It has something to do with the fin.stx file.
Any help is welcome.
Cheers,
Joao
Joao Jesus
jpjesus@netcabo.pt
jpjesus@netcabo.pt
0
Comments
-
Try this example:
OBJECT Form 90000 test duration { OBJECT-PROPERTIES { Date=07/12/06; Time=12:32:46; Modified=Yes; Version List=; } PROPERTIES { Width=8000; Height=8000; OnOpenForm=BEGIN decTime1 := fctTime2Decimal(TIME); END; OnCloseForm=BEGIN decTime2 := fctTime2Decimal(TIME); decDuration := decTime2 - decTime1; MESSAGE('Duration: %1',fctDecimal2Time(decDuration)); END; } CONTROLS { } CODE { VAR decDuration@1000000002 : Decimal; decTime1@1000000003 : Decimal; decTime2@1000000004 : Decimal; PROCEDURE fctTime2Decimal@1000000000(T@1000000000 : Time) : Decimal; VAR d@1000000001 : Decimal; BEGIN //fctTime2Decimal IF T = 0T THEN EXIT(0.0); d := T- 000001T + 1000.0; EXIT(d / 3600000); END; PROCEDURE fctDecimal2Time@1000000002(D@1000000000 : Decimal) : Time; BEGIN //fctDecimal2Time IF D = 0.0 THEN EXIT(0T) ELSE EXIT(000001T + (ROUND((D * 3600000 - 1000),1))); END; BEGIN END. } }
Run the form through the Object Designer, then close the form. The duration will then be displayed.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Thanks very much for your help.
And as usual, most solutions are the simple ones.
All it takes to show the duration in 'hh:mm:ss' notation is to create a time variable (timeDuration) and then do the following:
timeDuration := 000000T + durDuration;
It's that simple.
Cheers,
JoaoJoao Jesus
jpjesus@netcabo.pt0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions