Z Programs
Z.elapsed.time
Computes the elapsed time between two combinations of date/time
Arguments: A =End date
B - End time
C - Start date
D - Start Time
E - format of
output
The dates must be in the internal NPR format: YYYYMMDD
The times must be in the HHMM format. If they are in TIME format, call %Z.time.out to convert them to
HHMM.
Argument E is used to determine the output format. It is entered as a quoted
string, eg, "hh HRS".
The string will be interpreted for three keywords, and
will make substitutions for those keywords. All other text in the string will
be outputted as entered.
The keywords are:
hh" - number of hours
"mm" - number of minutes
"hh.hh" - number of hours to two
decimal points
Example list of the formats and the results given a stay of 11
hours and 35 minutes:
Format
Output
"hh Hrs mm Mins" 11 Hrs 35 Mins
"hh.hh Hours"
11.6 Hours
"hh/mm" 11/35
"hh hours" 12 hours
"hh.mm" 11:35
Notes:
1) if "hh.hh" is entered, do not also enter
"hh" or "mm"
2) if "hh" is used without "mm",
"hh" will be rounded to the nearest hour.
3) if "hh.mm" is found in the format string,
"hh:mm" is substituted.
Example call: %Z.elapsed.time(20000101,1300,19991231,1200,hh.hh)
returns 25.00
%Z.elapsed.time(20000101,1300,19991231,1230,hh.mm)
returns 24:30
%Z.elapsed.time(20000101,1300,19991231,1230,hh.hh)
returns 24.50
When adding elapsed times to compute averages, use hh.hh, adding
hours and minutes as if they were decimals will produce inaccurate results.
Posted: August 03, 2001
