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

HPDATEFORMAT

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701
Edition 7 E0300 ♥
Edition 6 E0195

NM callable only.

You can use this routine to format the dates that can be combinations of display formats as explained below. Many of these elements are taken from ALLBASE/SQL date formats.

You can convert dates in the \Supported Date Formats" to a display string of your choice (with restrictions). The HPDATEFORMAT intrinsic will accept these format strings. The format specifcation strings can have the following syntax:

  [{Format Element}{Punctuation}]

Parameters


Valid Parameters for Format Element

Table 7-9 Format Specification Strings

String Definition
CCCentury (01 to 99)
YYYYYear (0001 to 9999)
YYYear of century (00 to 99) with leading zeros suppressed (0 to 99)
QCalendar quarter of the year (1 to 4)
MMMonth of the year (01 to 12)
ZMMMonth of the year with leading zeros suppressed (1 to 12)
DDDay of the month (01 to 31)
ZDDDay of the month with leading zero suppressed (1 to 31)
DDDDay of the year (001 to 366).
ZDDDDDD with leading zeros suppressed (1 to 366)
DDay of the week (1 to 7 where Sunday is 1, Monday is 2, . . . )
WWWeek of the year (01 to 53)
ZWWWeek of the year with leading zero suppressed (1 to 53)
MonMonth of the year in ASCII format (Jan, Feb, . . . )
DayDay of the week in ASCII format (Sun, Mon, . . . )
MONMonth of the year in ASCII (uppercase) format (JAN, FEB, . . . )
DAYDay of the week in ASCII (uppercase) format (SUN, MON, . . . )

Table 7-10 Valid Characters for Punctuation

Character Definition
-Hyphen
/Slash
.Dot
' 'Blank
,Comma
"Null

Thus, YYYY.MON.DAY, YY/MM/DD, DDMONYY, and DD-ZMM-YYYY are valid date formts. For example, "31 jan 1997" when formatted through DD-ZMM-YYYY results in "31-1-1997," formatted through YYYY/MM/DAY results in "1997.JAN.FRI," while YYYYMMDD results in "19970131."


NOTE: Mixing the NULL punctuation character with other punctuation characters is not allowed. Thus, YYYY/MM/DD is a valid format, while YYYYMM/DD is not.

Syntax



              I32V      *          CA          CA       I32 
  HPDATEDIFF (datecode, inputdate, formatspec, fmtdate, fmtdatlen,
  
    I32     I32V
    status, cutoff);

Parameters


datecode

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."

inputdate

is the input date

The interpretation depends on the value of datecode.

See the table,"Supported Date Formats," for the supported date codes and their layouts.

formatspec

is a character array (required)

This should be a NULL terminated string as per the syntax explained above in the table, "Format Specification Strings."

fmtdate

is a character array (required)

This array size should be at least that of formatspec. On return, it will contain the date formatted as per the formatspec.

If an invalid date is passed, on return from the intrinsic its contents will be "UNKNOWN." For the "HP Standard Formats," if special values in the table, "Special Date Values," are passed for date parameter, on return from the intrinsic, the value of the string will be appropriately initialized. For example, for the date type 18, the initialized values for different special date values are as follows:

Date Value Returned Contents

00000000 "UNKNOWN"
00000101 "INVALID"
00000102 "NEVER"
00000103 "NEEDED"
00000104 "EXPIRED"
00000105 "ILLEGAL"

If the character array passed does not have enough space to hold the special values or the formatted date, the behavior is undefined.

fmtdatelen

is a 32 bit integer by reference (required)

On input, it is the length of the formatspec parameter.

On return, it represents the number of characters HPDATEFORMAT placed into fmtdate.

status

is a 32 bit integer by reference

The HPE_STATUS parameter through which the error codes are returned. A value of 0 indicates no errors and no warnings.

cutoff

is a 32 bit signed integer by value (optional)

This is used in validating and converting the two-digit years to four digit ones before computing the difference. (See HPDATECONVERT documentation for more information.)

Operation Notes


Related Information


Intrinsics

HPCALENDAR, HPDATECONVERT, HPDATEDIFF, HPDATEOFFSET, HPDATEVALIDATE, HPFMTCALENDAR




HPDATEDIFF


HPDATEOFFSET