Re: Converting interval to decimal ?
Posted in 1995
> > 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 . > > Thanks in advance , > Chago > MAIN DEFINE now DATETIME HOUR TO SECOND, A, B, C CHAR(2), D, E, F DECIMAL LET now = CURRENT HOUR TO SECOND LET A = extend(now, HOUR TO HOUR) LET B = extend(now, MINUTE TO MINUTE) LET C = extend(now, SECOND TO SECOND) LET D = A / 24 LET E = B / 60 LET F = C / 60 DISPLAY now DISPLAY A, B, C DISPLAY D, E, F END MAIN The trick is that you can't pop the extended value into anything but a CHAR (in my experience). From there you can use the char at will. cheers j. _____________________________________________________________________________ Jack Parker - Hewlett Packard, BSMC Boise, Idaho, USA jparker@hpbs3645.boi.hp.com _____________________________________________________________________________ "Character is what you are in the dark" - Emilio Lizardo _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________