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?
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';
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.
Answers
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 text
This will give you a runtime error
But 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.