Note: Built-In Function Rules Usage Options
Converts format of numeric date.
Arguments
|
Valid Date Formats
Return Values
|
Technical Notes
All dates must have a four digit year
So that accurate comparisons and calculations can be performed, all dates must have a four digit year. Where a two digit year (e.g. DDMMYY, YYMMDD, MMYY) is supplied the century value is retrieved from the system definition data area. The year supplied is compared to a year in the data area, if the supplied year is less than or equal to the comparison year then the less than century is used. If the supplied year is greater than the comparison year then the greater than century is used.
First argument and return value specifics
For the first argument and the first return Value, INTEGER and FLOAT fields cannot be used.
The DATE field cannot be used directly. However, the DATE field can be used indirectly when being converted into Number using the .AsNumber Intrinsic Function.
The value of the second argument should be in sync with the format that is put into the Intrinsic Function.
For example if you have a DATE field called DATEFL1, and you want to use it in the Built-In Function as the first argument, you must do a conversion like this:
DATEFL1.AsNumber(DDMMCCYY)
Please refer to the Intrinsic Function for other formats
The value of the second argument should be H, which indicates the DDMMYYYY date format.
To hold the first return value, any NUMERIC field can be used including INTEGER and FLOAT.
Translations
When using date formats P, Q, R, S, T, U, the date is returned in the format specified in messages BIF0101 and BIF0102 in DC@M01. To have the date returned in a language other than English you should ensure these messages are translated into the appropriate language.
If LANG is something other than ENG or NAT, you will need to ensure the messages exist in the message file for the language you are executing in.
Example RDMLX only:
Use CONVERTDATE_NUMERIC with DATE field type only.
USE BUILTIN(CONVERTDATE_NUMERIC) WITH_ARGS(#DATEFL1.AsNumber(DDMMCCYY) H J)TO_GET(#NUM80 )
The following code must be used for a better programming style:
#NUM80 := #DATEFL1. AsNumber (CCYYMMDD)
#NUM80 is a numeric signed 8 bytes long ,0 decimal .
Example RDML
Convert a date field #YMD in date format YYMMDD (D) to date format DDMMYY (B) in field #DMY:
USE BUILTIN(CONVERTDATE_NUMERIC) WITH_ARGS(#YMD D B) TO_GET(#DMY)