iSeries/i5 Cool Things.
Home Books Tips & Tricks Links Blog Contacts


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.

ValueDescriptionSample
*YYMD8 Digit Year/Month/Day Format20020501 = 5/20/2002
*CYMD7 Digit Year/Month/Day Format1020501 = 5/20/2002
*YMD6 Digit Year/Month/Day Format020501 = 5/20/2002
*MDYY8 Digit Month/Day/Year Format05012002 = 5/20/2002
*MDY6 Digit Month/Day/Year Format050102 = 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.
��

| Home | Books | Tips & Tricks | Links | Blog | Contact |

Hosted by www.Geocities.ws

1