The d processing code invokes the date conversion function to convert an external date to internal format, or more commonly, to convert an internal date to one of many available output formats.
By convention, day 0 (in internal format) on the D3 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 30, 1967, is -1.
|System Processors||Select, Update, List|
|Code Type||Attribute Defining|
|Dictionary Attributes||Input Conversion, Output Conversion, Correlative|
|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. Assume current month and year on input.|
|options||Character options are defined as:|
|d||Numeric day of the month (1 through 31).|
|f||Full external date with alphabetic month, day of the month, a comma, and 4-digit year (for example, October 9, 1990). Valid when used with the yr.pos specification. Not valid when used with the outsep specification.|
|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 preprocessing phase of AQL. Any legal date conversion can be specified on the output-conversion attribute prior to displaying the date.|
|j||Julian day of the year (1 through 366).|
|m||Numeric month (1 through 12).|
|ma||Alphabetic month (January, February, and so on).|
|q||Numeric quarter (1 through 4).|
|w||Numeric day of the week (1=Monday, 2=Tuesday, 3=Wednesday, and so on).|
|wa||Alphabetic day of week (Sunday, Monday, and so on).|
|y||Year (default is four digits). Valid when used with the yr.pos specification. Not valid when used with the outsep specification.|
|outsep|| Specifies the output separation
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 output separation character 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 number of display digits for the year (dd mmm yyyy or dd mmm yy format).
|e||Uses european date format regardless of current system default setting|
|u||Uses United States date format regardless of current system default settings|
The following table provides the valid formats to input dates through the Update processor or when using the d processing code in an iconv statement:
|mm/dd/yy||Default and any separator may be used (for example, 6*26*87).|
|mm/dd||Year is the same as the system date.|
|mmdd||Year is the same as the system date (when in standard format).|
|dd||Month and year are the same as the system date. It is necessary to use the dn variant to get this functionality.|
|ddd||Julian date (1 through 366).|
|yyddd||Julian date (five digits).|
|yymmdd||Military date if in US mode.|
|ddmmyy||Military date if in European mode.|
If the d processing code is used as an input-conversion in the Update processor, a period (.) may be entered to duplicate the last date entered. The forward-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.
When the d processing code is used as an output-conversion, it converts the internal date to an external format.
The d processing 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, 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.
|10594||d||01 Jan 1997|
|-10594||d4||29 Dec 1938|
|Entered:||Internal julian day:|
|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 converts to the internal representation for the years 2000 to 2029. To enter the years 1900 to 1929, then it is necessary to enter all four digits of the year.
The functionality for mask and date conversions is not intuitive when combined with selection criteria in an AQL sentence. If a mask or date conversion exists in the output-conversion (attribute 7), that conversion is applied to the selection criteria in an AQL statement. For instance, in the sentence:
select filename with attr "90]"
where the data contains such values as 9000, 9010, 9020, and so on, the "90]" is converted by an mr2 to "9000]". The logic is to convert the selection criteria once, rather than converting each value that is processed by the select command. Moving the mr2 to the correlative attribute (attribute 8) bypasses the conversion to the selection criteria.
casing statement, Conversion expression, date command, date() function, External format, iconv() function, Processing codes (Update processor), Internal format, oconv() function, output-conversion, Processing codes overview, Processing codes (Update processor), set-date-format command, set-date-std command, timedate() function, u1193 user exit, u7193 user exit