Display Duration in HH:MM in page field

kmkaot
Member Posts: 261
Dear Friends,
Will you advice me how to display duration in simple form. like HH::MM format in page
Warm Regards
Kris
Will you advice me how to display duration in simple form. like HH::MM format in page
Warm Regards
Kris
0
Answers
-
Use a var of Duration type, or assign an expression endtime-starttime as the source expression.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
I got field with Duration data type. Just I need display in my worksheet type page.
Warm Regards0 -
So it should already format the duration properly for you. What's the problem then?Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
It is displaying like 30 hours, 40 miniatures, 25 seconds. It should be like 30::40::250
-
If it is only for displaying (no edit) then add a function on your page preparing the duration in the formatting which suits you.
Unfortunately FORMAT with a format property will not do, the duration values accepts ony 3 standard formatting string, result none of which is close to what you need. At least I am not aware of any other format string which can be applied to the durartion var
You would have to do someting like this:Hours := ROUND(Duration / (60 * 60 * 1000L), 1, '<'); Minutes := ROUND(Duration / (60 * 1000L), 1, '<') MOD 60; Seconds := ROUND(Duration / 1000L, 1, '<') MOD 60; DurationText := STRSUBSTNO('%1:%2:%3', Hours, Minutes, Seconds);
Or use DotNet varsSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
There is an easier solution by creating a variable of type time, adding the duration to it and format the result:
TimeVariable := 000000T + durationVariable; Message(format(TimeVariable,0,'<Hours>::<Minutes>'));
1
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