Hi everybody in my first post
I have searched about duration topics but I haven't been able to find a solution for this problem.
I have a report in whose final footer I show my duration variable "TotalDuration", whose code I have set TotalDuration := TotalDuration + "To-do".Duration;
Then it shows the result like (e.g.) 1 day 5 hours 40 minutes, but I want it to be displayed as 29 hours 40 minutes.
Also, I don't mind creating other decimal-type variable if it would be easier (in this e.g., 29:40)
Any idea? Thanks in advance!
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks!!
Best will be only on your report, it means only where you really need it...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Any idea?? Thanks
but perhaps the easiest solution would be in duration type, could anyone tell me how can I get my total duration only in hours, I mean, 50 hours 10 minutes instead of 2 days 2 hours 10 minutes, please? probably it's easy...but i'm new at programming... :roll: thanks in advance
MyDuration mod 1000 = milliseconds
MyDuration div 1000 = "rest in seconds"
"Rest in seconds" mod 60 = seconds
"Rest in seconds" div 60 = "Rest in minutes"
"Rest in minutes" mod 60 = minutes
"Rest in minutes" div 60 = "Rest in hours"
etc...
After that you can create the string...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Milisec := TotalDuration MOD 1000;
RestSec := TotalDuration DIV 1000;
Sec:= RestSec MOD 60;
RestMin := RestSec DIV 60;
Min := RestMin MOD 60;
RestHour := RestMin DIV 60;
DurationString := FORMAT(RestHour) +' hours '+ FORMAT(Min) +' minutes';