pc.d Processing Code/Restore Processor


Command pc.d Processing Code/Restore Processor
Applicable release versions: AP, AP 6.1, R83
Category Restore Processor (84)
Description invokes the date conversion function, to convert an external date to internal format, or to convert an internal date to one of many available output formats.

By convention, day "0" (in "internal" format) on the Pick calendar is December 31, 1967. It was selected in 1968 and has never been changed, thereby retaining compatibility. For example, June 26, 1987 has an internal value of 7117, which is the number of days since 12/31/67. It follows that 7118 is June 27, 1987. Dates before 1968 are stored as negative numbers. For example, December 30th, 1967 is "-1".

"yr.pos" specifies the number of display digits for the year. For example, if the internal date is 7117, "d2" returns 26 Jun 87. Valid entries are 0, 1, 2, 3, or 4. The default is 4.

The parameters specified in "skipdel" and "#skips" are functionally equivalent to the "g" (group extract) processing code. They define the position of the date value portion in a multi-part data value and for the most part, are unused.

The "outsep" (output separation character) parameter specifies the character that delimits the month, day and year values. Popular characters to use are "-", as in "12-23-1955", or "/", as in "1/16/1997".

If the "outsep" parameter is omitted, then a " " (space) is assumed.

The output order is: 2-digit day, 3-digit month abbreviation and year. The number of year digits depends on the "yr.pos" parameter (dd mmm yyyy or dd mmm yy).

The following formats can be used to input dates:

Format Description

mm/dd/yy Default - any separator may be used (e.g., 6*26*87).
mm/dd Year is same as system date.
mmdd Year is same as system date (when in "standard" format)
dd Month and year are same as system date. On releases 6.1.0 and above, it is necessary to use the "dn" variant to get this functionality. The normal "d" conversion returns null in this case for compatibility with R83.
dd/mm/yy "European" format.
dd/mm "European" format.
ddd Julian date (1-366).
yyddd Julian date (five digits).
yymmdd Military date if in US mode.
ddmmyy Military date if in European mode.

If the date processing code is used as an input-conversion in the Update processor, a period (".") may be entered to duplicate the last date entered. The "/" (slash) by itself may be used to insert the current day's date.

If the "d" processing code is specified as an input-conversion, no codes are required for input date conversion except for the Julian and European formats, since the format is obvious in all other cases. If the "n" character is added after the "d", then the user can pass the numeric day of the month, and the function returns the correct internal date assuming the current month and year (6.1 and above only).

When the date processing code is used as an output-conversion, it converts the internal date to an external format as specified by one of the following optional character codes:

The "char.code" may be any of the following:

d Numeric day of the month (1-31).

f Full external date with alphabetic month, day of the month and four-digit year (e.g., October 9, 1990).

i This is a special case used when data is stored in its internal representation. It is typically used on the correlative attribute to convert an external date to its internal equivalent in the pre-processing phase of Access. Any legal date conversion may be specified on the output-conversion attribute prior to displaying the date.

j Julian day of the year (1-366).

m Numeric month (1-12).

ma Alphabetic month (January, February, ...)

q Numeric quarter (1-4).

w Numeric day of the week (1=Monday, 2=Tuesday, 3=Wednesday, ...).

wa Alphabetic day of week (Sunday, Monday, ...).

y Year (default is 4 digits).

The date code with no parameters converts legal date formats into the internal date (number of days from 12/31/67).

When used in a BASIC program in an oconv() statement, the results may be in either all uppercase (as in R83), or in mixed Upper/lowercase. If casing is off, then the output will be in Upper/lowercase. If casing is on, then the output will be in Uppercase only.
Syntax d{n}{yr.pos}{skipdel #skips}{outsep}
data     code  sample output

10594    d     01 Jan 1997
10594    d2-   01-01-97
10594    d-    01-01-1997
10594    d0    01 Jan
10594    d0-   01-01
10594    dd    1
1/1/97   di    10594
10677    dj    84
10594    dm    1
10594    dma   January
10594    dq    1
10594    dw    3
10594    dwa   Wednesday
10594    dy    1997
10594    d2y   97
-10594   d4    29 Dec 1938
Related basic.date