CONVERTDATEANDTIME Procedure

You can use the CONVERTDATEANDTIME procedure to convert universal times and dates to local times and dates and to convert local times and dates to universal times and dates. To use this procedure, use the following declaration:

INTEGER PROCEDURE CONVERTDATEANDTIME (WHICH, UD, UT, LD, LT, TZOFF);
                               VALUE  WHICH,                 TZOFF;
                             INTEGER  WHICH, UD, UT, LD, LT, TZOFF;
     LIBRARY MCPSUPPORT;

The parameters for CONVERTDATEANDTIME are as follows:

Parameter

Meaning

WHICH

Value of 1 to convert local date and time to universal date and time. Value of 2 to convert universal date and time to local date and time.

UD

Universal Julian date in form yyyddd. The year (yyy) is 1900 less than the actual year. For example, 099356 represents December 31, 1999, and 100001 January 1, 2000. When the WHICH parameter equals 1, the procedure returns the universal date in the UD parameter. When the WHICH parameter equals 2, you must supply the universal date to be converted in the UD parameter.

UT

Universal time of day in microseconds. When the WHICH parameter equals 1 the procedure returns the universal time in the UT parameter. When the WHICH parameter equals 2 you must supply the universal time to be converted in the UT parameter.

LD

Local Julian date in form yyyddd. The year (yyy) is 1900 less than the actual year. For example, 099356 represents December 31, 1999, and 100001 January 1, 2000. When the WHICH parameter equals 2 the procedure returns the local date in the LD parameter. When the WHICH parameter equals 1, you must supply the local date to be converted in the LD parameter.

LT

Local time of day in microseconds. When the WHICH parameter equals 2 the procedure returns the local time in the LT parameter. When the WHICH parameter equals 1 you must supply the local time to be converted in the LT parameter.

TZOFF

Offset of universal time from local time. TZOFF is expressed in minutes. A negative value indicates that local time is earlier than universal time. A positive value indicates that local time is later than universal time. TZOFF must be in the range –24*60 through +24*60.

The CONVERTDATEANDTIME procedure returns a zero (0) value if the conversion is successful. It returns a negative value if one or more of the parameters are out of bounds (if the input time parameter, in LT or UT, is less than 0 or greater than 24*60*60*1000000).