MAINSAIL Language Manual, Section 33.6

previous   next   top   contents   index   framed top   this page unframed


33.6. $dateAndTimeDifference

Figure 33–6. $dateAndTimeDifference
BOOLEAN
PROCEDURE   $dateAndTimeDifference
                        (
LONG INTEGER startDate,startTime;
                         
LONG INTEGER stopDate,stopTime;
                         
PRODUCES LONG INTEGER
                             
dateDif,timeDif;
                         
OPTIONAL BITS ctrlBits);

$dateAndTimeDifference produces the difference between two MAINSAIL date-time pairs.

startDate, startTime, stopDate, and stopTime must be valid MAINSAIL dates and times; they may be absolute (GMT or local) dates and times or date and time differences.

If the times are absolute (they need not be the same format; i.e., the start time may be GMT and the stop time local or vice versa, provided time conversion is available), the start time is startTime on startDate, and the stop time is stopTime on stopDate. If the times are time differences, the start time is simply subtracted from the stop time. The difference between the start time and the stop time is dateDif days plus timeDif seconds in time difference format (so that the magnitude of timeDif is always less than one day). dateDif and timeDif have the same signs, unless one is zero and the other is not. If the start time is before the stop time (if inputs are absolute) or less than the stop time (if inputs are differences), the difference is positive; if after or greater, it is negative.

The following are some sample results from $dateAndTimeDifference:

startDate startTime stopDate stopTime dateDif timeDif
28 August 1992 15:00:00 29 August 1992 1:00:00 0 days 10 hr 0 min 0 sec
28 August 1992 15:00:00 30 August 1992 12:34:56 1 day 21 hr 34 min 56 sec
29 August 1992 1:00:00 28 August 1992 15:00:00 0 days -10 hr 0 min 0 sec
30 August 1992 12:34:56 28 August 1992 15:00:00 -1 day -21 hr 34 min 56 sec
1 day 2 hr 3 min 4 sec 2 days 3 hr 4 min 5 sec 1 day 1 hr 1 min 1 sec

$dateAndTimeDifference returns FALSE if any of the argument dates and times is invalid or in an incompatible format, TRUE otherwise.

The only valid ctrlBits bit is errorOK. Unless it is specified, an error message is generated for erroneous input values.

The standard MAINSAIL date and time formats are described in Section 24.1. Subtracting one date or time by itself from another in the same format may be accomplished by means of the LONG INTEGER-” operator.


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 33.6