CONVERTING INTERVAL TO DE
Posted in 1995
7> From: Santiago Albanese <75030.2743@CompuServe.COM> 7> Is there a way to convert an hour to minutes interval to > a decimal value for a report ? . I am running a 4gl prog that > reports hors worked in the interval form of ( 8:40 ) for eigth > hors and forty minutes and I want to display it as 8.66 hours . I > have worked a solution with awk but would prefer to do it with > 4gl code . here's a code snippet that can help you out: define time_char char (5), #will hold value like "22:30" minute_decimal decimal (2,2), #will hold value like "0.58" minute_char char (5), #to convert the decimal to a char display_time char (5), #to display the final results let time_char = CURRENT HOUR TO MINUTE #or from wherever you get a time let minute_decimal = time_char[4,5] / 60 let minute_char = minute_decimal let display_time = time_char[1,2], minute_char[2,4] ... You could modify this to suit your specific needs. It may not be the best, but it's short, and you could put this all in a function which received the datetime and returned that char in the decimal format. Tim --- ~ SPEED 1.40 [NR] ~