HPlogo MPE/iX Intrinsics Reference Manual > Chapter 7 Command Definitions (HP32208-HPLOACNMPROC)

HPDATECONVERT

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701 ♥
Edition 7 E0300
Edition 6 E0195

NM callable only.

Converts the dates from one supported format to another.

Syntax



                 I32V       *          I32V        *
  HPDATECONVERT (inputcode, inputdate, outputcode, outputdate,
                 I32     I32V
                 status, cutoff);

Parameters


inputcode

is a 32-bit signed integer by value.

The value should be one of the date type codes listed in the table, "Supported Date Formats" found below.

inputdate

varies for type by reference.

The interpretation depends upon the value of inputcode. See the table, "Supported Date Formats," for the supported date codes and their layouts.

outputcode

is a 32-bit signed integer by value.

The value should be one of the date type codes listed in the table, "Supported Date Formats."

outputdate

returns the date as per the format chosen by the outputcode parameter

See the table "Supported Date Formats" for the supported datecodes and their layouts.

status

is a 32-bit signed integer by reference.

This is an HPE STATUS parameter through which the error codes are returned. A value of 0 indicates no error and no warnings.

cutoff

is a 32-bit signed integer by value (optional)

This is used in validating the input parameter when the input date has two-digit year. This is a required parameter for dates with two-digit years. In all other cases, this parameter is ignored.

If the cutoff parameter is given as -1, the value of the CI environment variable HPSPLITYEAR is used as the cutoff year.

This parameter's value should be in the range 0..100. If the value of the parameter is 50, two digit years in the range 0..49 will translate to 2000..2049 and those in the range 50..99 will be translated to 1950..1999. If you specify the cutoff year as 70, the mapping will be 0..69 as 2000..2069 and 70..99 as 1970..1999.

Table 7-8 Supported Date Formats

Date Type Code Storage Type #Bytes

Explanation

Sortable

Y2K Ready?

1longint8 MPE time-stamp
(microseconds since 1970-01-01)
yesyes
2integer4 Upper 2 bytes: year
3rd byte: month of year
4th byte: day of month
yesyes
3integer4 Upper 2 bytes: year
bottom 2 bytes: day of year
yesyes
4integer4 Upper 23 bits: #years since 1900
bottom 9 bits: day of the year.
(HPCALENDAR format; valid up to 9999-12-31)
yesyes
10integer4 Seconds since 1970-01-01
(POSIX.1 time() format; valid through 2038-01-18
yesyes
14shortint2 Upper 7 bits: #years snce 1900
Lower 9 bits: day of the year
(CALENDAR format; valid up to 2027-12-31)
yesyes
15integer4 YYMMDD dateyesno
16integer4 MMDDYY datenono
17integer4 DDMMYY datenono
18integer4 YYYYMMDD dateyesyes
25ASCII6 YYMMDD dateyesno
26ASCII6 MMDDYY datenono
27ASCII6 DDMMYY datenono
35ASCII6 YYMMDD date YY:MM3000 dateyesyes
36ASCII6 MMDDYY date YY:MM3000 datenoyes
37ASCII6 DDMMYY date YY:MM3000 datenoyes
38ASCII8 YYYYMMDD dateyesyes

Operation Notes


The date intrinsics support dates in the range 0001-01-01 through 9999-12-31. They use the Gregorian calendar for all calculations, including the rule for leap years (even though the Gregorian calendar was not in use prior to year 1582). This calendar also ignores the fact that calendars in different countries changed at different times (around the year 1753). All the "DATE" intrinsics accept byte aligned input/output date parameters.On an error, the intrinsic initializes the output parameters to either a binary zero or a blank string depending on the type of the parameter. Though the date type "4" can represent years beyond 9999, a year beyond 9999 (which needs five digits/characters) is considered an error.

Related Information


IntrinsicsHPCALENDAR, HPDATEDIFF, HPDATEFORMAT, HPDATEOFFSET, HPDATEVALIDATE, HPFMTCALENDAR
Manuals




HPCIPUTVAR


HPDATEDIFF