Am doing a time calculation in navision, where am calculating a time + time, Is it possible to calculate or need exact c/Al code for time calculation.
In this case one of the operand should be Time whereas other as integer (in MilliSeconds)..
For more details have a look on Codeunit 416 DateTime Mgmt.
For example, following code will increment the initial time defined by 1 minute (60*1000 mili seconds):
-Dhan Raj Bansal
Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal
What always helps me is to realize that the Time data type is representing a time instance, like 1 o'clock. So wanting to add two time instances (two Time variables) doesn't make sense. BEcause what would the outcome of:
1:00 AM + 5:00 PM = ?
To calculate a new time instance based on a current time instance you need to add a time duration being the "integer (in MilliSeconds" Dhan Rai refers to. So the calculation is:
New Time Instance = Old Time Instance + Time Duration
or in NAV data types:
Time := Time + Integer
Hopes this makes sense.
Luc van Vugt, Imtech ICTNever stop learningVan Vugt's dynamiXsDutch Dynamics Community
Luc van Vugt:So wanting to add two time instances (two Time variables) doesn't make sense
Else - to calculate two times results in an integer. If you want the result in a time-datatype the formula is "ResultTime := 00T + (ActualTime - StartTime)" (00T allows type conversion from integer to time).
But that is still not adding two time instance.
StartTime + EstimatedTimeLft = ExpectedEndTime
This equation is of type:
How do you calculate the difference between 2 time instances ? I need to get a duration, based on a starting and ending time ie
Duration = End time - Start time.
This however does not compile.
What is you exact code?
Your basic logic is OK:
Avril:Duration = End time - Start time
But the fact that it does not compile is probably due to soem error in the syntax of you code. So what's your code and also give the definitations of the variables included.
I've to calculate a total time of a work adding two duration:
Total Time := (FinalTime1 - InitTime1) + (FinalTime2 - InitTime2). Is it possible?
What kind of types must be the variables?Is Total Time a integer in milliseconds?
Thank You so much
Yes Total Time should be Integer datatype and result will be in milliseconds..
© 1995-2013 Dynamics User Group, all rights reserved.