d (date)

d (date)


cu (character update) Index Level date
Syntax d{n}{yr.pos}{skipdel #skips}{outsep}
d{n}{yr.pos}{char.option}{outsep}
Category Processing Codes
Type Processing Code
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 (release 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.
Options
See Also DATE set-date-format output-conversion set-date-std date.iconv conv.expression OCONV ICONV processing codes TIMEDATE external format date internal format date input-conversion u1193 u7193 Compile time/date stamps (R83) Compile stamps Processing Codes CASING
Example 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
Warnings When entering date values in the Update processor, a little care should be taken to enter the date properly. The system will convert the entry to an internal number, then convert it back to a date and display it. Sometimes the date conversion method appears to be inconsistent, and will display a different value:
Entered:     Internal julian day:
"01/01/01"   12055
"01.01.01"   12055
"1/1/1"      <null> - "invalid date entry"
"1.1.1"      <null> - "invalid date entry"

For convenience of entry on input conversions, 2-digit year entries are interpreted as (19)30 to (20)29, so the dates "01/01/00" to "12/31/29" will convert to the internal representation for the years 2000 to 2029.  If the user wishes to enter the years 1900 to 1929, then it is necessary to enter all 4 digits of the year.

The functionality for mask and date conversions is a bit obscure, espescially when combined with selection criteria in an Access sentence. If a mask or date conversion exists in the output-conversion, that conversion is applied to the selection criteria in the Access statement. For instance, in the sentence "select filename with attr "90]", where the data contains such values as 9000, 9010, 9020, etc., the "90]" gets converted by an MR2 to "9000]". The logic is to convert the selection criteria once, rather than to convert each value that is processed by the SELECT. Moving the MR2 to the correlative attribute bypasses the conversion to the selection criteria.
Compatibility D3 7.0 AP AP 6.1 R83
cu (character update) Index Level date