duration to time

kanika
Member Posts: 247
Hi Experts!!
I have a field type duration with value 1132690
I want to pass it to type time 00:00 h. but I can not find any function that does, only text with the format function but that is not what I need, is there any function?
As always thank you very much
I have a field type duration with value 1132690
I want to pass it to type time 00:00 h. but I can not find any function that does, only text with the format function but that is not what I need, is there any function?
As always thank you very much
0
Best Answer
-
aValue := FORMAT(aHours,0,'<Integer,2><Filler Character,0>') + ':' + FORMAT(aMinutes,0,'<Integer,2><Filler Character,0>'); EVALUATE(aTime,aValue);
5
Answers
-
aBigInteger := theDurationValue; aHours := ROUND(aBigInteger / 3600000,1,'<'); //60 minutes in a hour * 60 seconds in a minute * 1000 milliseconds in a second aBigInteger := aBigInteger MOD 3600000; aMinutes := ROUND(aBigInteger / 60000,1,'<'); //60 seconds in a minute * 1000 milliseconds in a second aBigInteger := aBigInteger MOD 60000; aSeconds := ROUND(aBigInteger / 1000,1,'<'); //1000 milliseconds in a second aBigInteger := aBigInteger MOD 1000; aFractions := ROUND(aBigInteger / 10,1,'<'); aValue := FORMAT(aHours,0,'<Integer,2><Filler Character,0>') + ':' + FORMAT(aMinutes,0,'<Integer,2><Filler Character,0>') + ' h';
0 -
Thanks!! duikmeester,
Then to create the time would be:
MyTime: = aHoursaMinutesT;
Can it be like this?
I need the data in time type to do calculations do not serve me in text0 -
aValue := FORMAT(aHours,0,'<Integer,2><Filler Character,0>') + ':' + FORMAT(aMinutes,0,'<Integer,2><Filler Character,0>'); EVALUATE(aTime,aValue);
5 -
Thank you so much!!0
-
BlackTiger wrote: »
DateTimeValue := 0DT + DurationValue;
This will give you a runtime errorThe date is not valid.
ButTimeValue := 000000T + DurationValue;
will give you a time value, which, properly formatted, might serve you as a base for displaying as duration provided the duration is short enough (i.e. depending on your time format shorter than 12 or 24 hours). You probably still would need a custom format string to format it sensibly in order to show it, for example, in a column of a table.
Note: 0T gives you an undefined time, 000000T gives you the start of a day.0 -
Thank you so much!!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
- 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