Convert Decimal To Duration
ricky76
Member Posts: 204
Any one if this is possible and if so how to do it?
0
Comments
-
Hello ricky76,
Try :Name >DataType Dur > Duration Dec > Decimal ---------------------------------- Dec := 22; EVALUATE(Dur,FORMAT(Dec)); message('%1',Dur);The answer of the message is :: "22 hours"
Let me know if this is what you mean..Met vriendelijke groet, best regards,
Rvduuren0 -
Thank you very much rvduuren that's perfect. Just another quick question. If the duration is over one day it displays as 1 day 2 hours etc. Is there a way i can display this as 26 hours?0
-
Hello Ricky,
Try:Globals Name > DataType Dur > Duration BigInt > BigInteger ----------------------------- EVALUATE(Dur,'26'); BigInt := Dur; message('%1 Hour',BigInt/3600000);The answer of the message is :: "26 hours"
I hope this is useful for you, let me know..C/Al Help >>
BIGINTEGER
Use this data type to store very large whole numbers. This data type is a 64 bit integer. You must add an L to the constant definition to inform C/AL that the integer must be interpreted and treated as a BIGINTEGER.
DURATION
Use this data type to represent the difference between two datetimes, in milliseconds. This value can be negative. It is a 64 bit integer.
DATETIME-DATETIME=DURATION
DATETIME-DURATION=DATETIME
DATETIME+DURATION=DATETIMEMet vriendelijke groet, best regards,
Rvduuren0 -
Everything is going fine now thanks just one more problem. I have a datetime field that looks at the time someone clocks in. If they clock in before 6:00 the report needs to identify this and put 6:00 rather than the time they clocked in at. Any ideas?0
-
You can use DT2TIME and DT2DATE to split the DT to DATE and TIME. After that you can test the time, correct it to 6:00 if needed and reconstruct the DT with CREATEDATETIME...0
-
Ok i am fine to this point but how do i do the test against the time part?0
-
if myTime < 1400T then
myTime := 1400T0 -
Thank you kindly folks.0
-
Hi Guys,
I'm looking for a little bit of clarification on the above. I've looked through the application designers guide and the Navision Financials Help and I'm a little stuck..
I understand what is explained above, however how would one do a comparison of two times and obtain a decimal representation in hours? For example:
StartTime := 0900T;
EndTime := 1500T;
So the difference should be 6 hours. I've done something very similar in Excel but im not that familiar with the date & time functions that are available within Navision.
Excel Formula
(C8-C7+(C8<C7))*24
C8 = EndTime
C7 = StartTime
So using the above would be as follows:
C8 would equate to 0.625
C7 would equate to 0.375
Which would equal 0.25. In this instance the EndTime is not less than the StartTime so we then multiply the first part of the equation (0.25) by 24 giving the answer of 6 hours.
Hope i make sense?0 -
One tip: In Navision, when you subtract time variables, result is integer representing the duration in milliseconds.0
-
Thanks very much for the advice! I should have really noticed from the above info #-o
I think this might help a few other people that come across this, especially if they dont have a lot of coding experience with Navision like myself.0 -
If you have time1 and time2 and want then result time3=time2-time1, how to do ?
NB : no get on message but in a variable time30 -
You can try something like:
time3 := 0T + (Time1 - Time2);
but you must be sure that the time2 < time1.0
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
- 323 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

