When manipulating dates in CL I often resort to calling an RPG program. I finally created a command to perform date/time arithmetic. Others might find it useful so I posted the source: sourceforge.net/projects/ibm-i-cl-date-arithmetic/files/
It's simple: CHGDTETME DTETME(*CURRENT) DURATION(*SUB *DAY) RTNVAL(&RESULT)
(get yesterday's date)
And flexible: CHGDTETME DTETME('1988-06-01-00.00.00') DURATION(*ADD '0032-09-21-14.30.00') RTNVAL(&RESULT)
(Thirty two years, nine months, twenty one days, fourteen hours and thirty minutes will be added to DTETME, return value contains '2021-03-22-14.30.00'.)
It's simple: CHGDTETME DTETME(*CURRENT) DURATION(*SUB *DAY) RTNVAL(&RESULT)
(get yesterday's date)
And flexible: CHGDTETME DTETME('1988-06-01-00.00.00') DURATION(*ADD '0032-09-21-14.30.00') RTNVAL(&RESULT)
(Thirty two years, nine months, twenty one days, fourteen hours and thirty minutes will be added to DTETME, return value contains '2021-03-22-14.30.00'.)
Comment