I now have "Total Time" as decimal datatype. But the values give me results like 12.97. I needed the result to be in time. I have been having problems in converting decimals to time.
Any idea please?
Thanks
I would've by now just given in to an easy answer and stated dividing.
like take the .97 part w/ copystr or something, use some FORMAT's & EVLAUATES when needed & divide by 1.666 to give me the minutes. and throw it together in a text file vHour+':'+vMin
I've been playing around with Times, Durations & DateTimes in the last few days on manufacturing project...but I've found it all boils down to some really simple math.
If you take a look at the documentation it shows that DURATION = DATETIME +/- DATETIME. But a variable of Duration Data Type is also synonymous with BigInt and stores time in milliseconds (1/1000th of a second).
So what I've done is delcare 4 Variables:
tmeStart (Time) - start time from user form
tmeEnd (Time) - end time from user form
durElapsed (Duration) - Duration datatype
iElapsed (Big Integer) - to be used for calculations
iRunTime (Integer) - Run Time for Journal line - in minutes
I'm going to skip a lot of logic I had in my form that tested whether the user had populated Start Time/End Time, whether they were within tolerances, etc. Then to Calculat etime Run Time in Minutes I used:
Remember that you must subract the Start Time from the End time to get a positive duration.
If you use iElapsed (or any other Big Integer) you can convert a duration to whatever you like using this conversion table:
1 Second = 1000
1 Minute = 60000 (or 60 * 1000)
1 Hour = 3.6 Million (or 60 * 60 * 1000)
1 Day = 86.4 Million (or 24 * 60 *60 * 1000)
So if you divide iElapsed by the appropriate value above you can turn a duration into whatever you like (hours, mins, seconds, etc).
Comments
Any idea please?
Thanks
How do you display 11am - 2pm?
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
like take the .97 part w/ copystr or something, use some FORMAT's & EVLAUATES when needed & divide by 1.666 to give me the minutes. and throw it together in a text file vHour+':'+vMin
Sometimes I don't have the patients myself
http://www.BiloBeauty.com
http://www.autismspeaks.org
If you take a look at the documentation it shows that DURATION = DATETIME +/- DATETIME. But a variable of Duration Data Type is also synonymous with BigInt and stores time in milliseconds (1/1000th of a second).
So what I've done is delcare 4 Variables:
I'm going to skip a lot of logic I had in my form that tested whether the user had populated Start Time/End Time, whether they were within tolerances, etc. Then to Calculat etime Run Time in Minutes I used:
Remember that you must subract the Start Time from the End time to get a positive duration.
If you use iElapsed (or any other Big Integer) you can convert a duration to whatever you like using this conversion table:
1 Second = 1000
1 Minute = 60000 (or 60 * 1000)
1 Hour = 3.6 Million (or 60 * 60 * 1000)
1 Day = 86.4 Million (or 24 * 60 *60 * 1000)
So if you divide iElapsed by the appropriate value above you can turn a duration into whatever you like (hours, mins, seconds, etc).
Epimatic Corp.
http://www.epimatic.com
Thanks.
Epimatic Corp.
http://www.epimatic.com
Any idea please?