|
|
|
Date Conversion ILE FunctionTable
| �� |
Dealing with different date formats within an RPGLE program is one of those anoying little tasks that we all deal with. The ILE CvtDate function helps to make this process a little easier. This function will allow you to convert from any standard 6, 7 or 8 digit date format to any standard 6,7 or 8 digit format. Using this function is as easy as using the EVAL command shown here:
C Eval DSPDAT=CvtDate(FILDAT:'*YYMD':'*MDY')
This example will convert from the 8 digit year,month, day format FILDAT to the 6 digit month, day, year format in field DSPDAT to allow us to display a 6 digit standard date.
To use this function, you'll need the function prototype shown below.
The CvtDate function itself is shown in the box below. This function accepts the parameters, From Date, From Format, and To Date.
Valid values for the From and To date formats can be found in the table below.
| Value | Description | Sample |
| *YYMD | 8 Digit Year/Month/Day Format | 20020501 = 5/20/2002 |
| *CYMD | 7 Digit Year/Month/Day Format | 1020501 = 5/20/2002 |
| *YMD | 6 Digit Year/Month/Day Format | 020501 = 5/20/2002 |
| *MDYY | 8 Digit Month/Day/Year Format | 05012002 = 5/20/2002 |
| *MDY | 6 Digit Month/Day/Year Format | 050102 = 5/20/2002 |
Either select the text above and copy it to the clipboard
and paste it into SEU or click here to download
the source in a text file.� You'll also need to copy the prototype for this function into any ILE programs that will use the function. |
�� | |
|