The procedure below details how to calculate elapsed rental days in IQ. This will convert the open and close times (hours and minutes) to a total number of minutes and then convert that to a partial (decimal) day, rounding to the nearest hundredth. Then, by using some fixed date prior to any RA on the system, it calculated the total number of decimal days from the fixed point to the open date/time and to the close date/time, then subtracts the former from the latter.

The text below can be pasted into any IQ procedure. The field RENT-DAYS is the decimal elapsed days of the RA and that is the field to report. This example uses January 1, 2000 as the "fixed point" date. If there are RAs older than that in the database, an earlier date should be used. This procedure should be easily adaptable to other similar situations.

# Calculation for decimal open time ----
#
SUBTRACT R-OPENDATE MINUS 01-01-2000 GIVING OPEN-DAYS.
MULTIPLY R-OPENHOUR BY 60 GIVING OPEN-MINS.
MULTIPLY R-OPENHOUR BY 100 GIVING OPEN-HOUR.
SUBTRACT R-OPENTIME MINUS OPEN-HOUR GIVING OPEN-TIME-MINS.
ADD OPEN-TIME-MINS PLUS 1 GIVING OPEN-TIME-MINS.
ADD OPEN-TIME-MINS TO OPEN-MINS GIVING OPEN-MINS.
DIVIDE OPEN-MINS BY 1440 GIVING OPEN-PART-DAY SCALE 1.2 ROUND.
ADD OPEN-PART-DAY TO OPEN-DAYS GIVING OPEN-DAYS SCALE 1.2.
#
# Calculation for decimal close time ----
#
SUBTRACT R-CLOSDATE MINUS 01-01-2000 GIVING CLOSE-DAYS.
MULTIPLY R-CLOSHOUR BY 60 GIVING CLOSE-MINS.
MULTIPLY R-CLOSHOUR BY 100 GIVING CLOSE-HOUR.
SUBTRACT R-CLOSTIME MINUS CLOSE-HOUR GIVING CLOSE-TIME-MINS.
ADD CLOSE-TIME-MINS PLUS 1 GIVING CLOSE-TIME-MINS.
ADD CLOSE-TIME-MINS TO CLOSE-MINS GIVING CLOSE-MINS.
DIVIDE CLOSE-MINS BY 1440 GIVING CLOSE-PART-DAY SCALE 1.2 ROUND.
ADD CLOSE-PART-DAY TO CLOSE-DAYS GIVING CLOSE-DAYS SCALE 1.2.
#
SUBTRACT CLOSE-DAYS MINUS OPEN-DAYS GIVING RENT-DAYS.