` Printed Icetips Article

Icetips Article



Par2: Time calculations greater than 24 hours
2000-02-07 -- Sue Pichotta
 
LTimeStart and LTimeEnd are decimals.  The trick is, the date is
stored in the integer area, to the left of the decimal point, and
the time is stored in the fractional area, to the right of the
decimal point.  Makes calculations across days easy.  (Greg
Bailey taught me this trick in my Compuserve days, and this paid
for me going to DevCon one year - was the basis of a talk I gave.
)

        LTimeStart = PAT:Sign_In_Date + (PAT:Sign_In_Time /
8640000)
        LTimeEnd = PAT:Triage_Start_Date + (PAT:Triage_Start_Time
/ 8640000)
        LWait = (LTimeEnd - LTimeStart) * 1440   ! change this
number to break it into min/sec
        IF LWait > 59                ! greater than one hour
            LHrs = LWait / 60
            LMin = LWait % 60
            LSignInTriageWait = (FORMAT(LHrs,@N3)) & ':' &
(FORMAT(LMin,@N02))
        ELSE
            LSignInTriageWait = '   :' & (FORMAT(LWait,@N02))
        END

(Also, remember when working with time, 0 = nothing, doesn't
register.  1 is the lowest valid value, 1/100 of a second past
midnight.)



Printed May 3, 2024, 10:12 pm
This article has been viewed/printed 35114 times.