D Code

Formatting Dates. The D code converts dates to stored format and upon output to one of many different external formats. Dates are stored internally as the number of days from the zero date, December 31, 1967 (for example, September 4, 1978, is stored as 3900).

Format

D [year] [{separator | subcode}]

Parameter(s)

year

Specifies the number of digits used to represent the year.

{separator}

Any nonnumeric character that separates the day, month, and year.

{subcode}

A special code that specifies one of several date formats.

The table below lists and summarizes the date subcodes.

Subcode

Description

D

Lists only the number of the day.

J

Lists only the Julian day of the year.

M

Lists only the number of the month.

MA

Lists only the name of the month.

Q

Lists only the number of the quarter.

W

Lists only the number of the day of the week (Sunday is 7).

WA

Lists only the name of the day of the week.

Y

Lists only the number of the year.

If either a nonnumeric separator or a subcode is specified, dates appear in the format 12/12/1967. If neither is specified, the format is 12 DEC 1967. For example, the conversion code in line 7 of the Attribute Definition item DATE in the ORDERS dictionary is:

D2/

This conversion code specifies two digits to represent the year and the slash character (/) to separate the day, month, and year. For example, if the date in internal format is 8601 and the conversion D2/ is applied, the external format is:

07/19/91

The table below shows sample uses of the D code.

Conversion

Output

D

19 JUL 1991

D0

19 JUL

D/

07/19/1991

D2/

07/19/91

D-

07-18-1991

DY

1991

DQ

3

DD

19

DM

7

DMA

JULY

See Also

Formatting Data

MT Code

ML and MR Codes

MC Codes

MCDX and MCXD Codes

MX and MY Codes