Home | IBM Manuals Direct | iBytes Library | Links | About | Book Store | On-Line Code |
iByte Subject – Easy date manipulation Dates can easily be formatted to the desired output with a definition specification and a move statement or two. The examples below show the output if the incoming date was UDATE with a value of (032901). Dates can be moved from a numeric field to a date field and vice versa. To convert a numeric date to a different type of numeric date two moves would be required. First a move to a field defined as a date type and then to the resulting numeric field. If we had a 6 digit numeric date of MMDDYY 032901 and wanted to convert it to an 8 digit numeric date of CCYYMMDD 20010329. We would first move the 6 digit date to an ISO format and then back to the 8 digit numeric date.
D TodayMDY
S
D DATFMT(*MDY)
D TodayISO S D DATFMT(*ISO) D TodayYMD S D DATFMT(*YMD) D TodayUSA S D DATFMT(*USA) D D FileYMD S 6 0 INZ(0) D FileCYMD S 8 0 INZ(0) C*
IF TODAYS DATE WAS 03/29/01 - MM/DD/YY C |