RedMage1967
Programmer
as400pro
I agreem with iSeriesCodePoet, that does look confusing. Even though it's more code, I think this is easier to read, and sticks to the KISS principle:
//Convert date from CCYYMMDD to MMDDYY
DateISO = %Date(); // Defined as CCYYMMDD
DateMDY = DateUSA; // Defined as MMDDYY
or is you want the current date stored in ISO format:
DateISO = %Date();
or you want the current date stored in MDY format:
// convert from Julian to CCYYMMDD
DateJul = %Date();
DateUSA = DateJul;
There are other things to consider, like where I'm getting the input data from, etc. But, I try just to stick with using the date opcodes and date data type. Makes the coding much simpler.
DateMDY = %Date();
RedMage1967
IBM Certifed - RPG IV Progammer
I agreem with iSeriesCodePoet, that does look confusing. Even though it's more code, I think this is easier to read, and sticks to the KISS principle:
//Convert date from CCYYMMDD to MMDDYY
DateISO = %Date(); // Defined as CCYYMMDD
DateMDY = DateUSA; // Defined as MMDDYY
or is you want the current date stored in ISO format:
DateISO = %Date();
or you want the current date stored in MDY format:
// convert from Julian to CCYYMMDD
DateJul = %Date();
DateUSA = DateJul;
There are other things to consider, like where I'm getting the input data from, etc. But, I try just to stick with using the date opcodes and date data type. Makes the coding much simpler.
DateMDY = %Date();
RedMage1967
IBM Certifed - RPG IV Progammer