RPGLE date format example
H DftName(TESTRPG) DftActGrp(*No) ActGrp(*New)
H Option(*srcstmt:*NoDebugIo)
D*
D*
D vDate S d datfmt(*ISO)
d wrk_date DS
D wrk_Cent 2
d wrk_year 2
d Wrk_Dates1 1
d wrk_month 2
d Wrk_Dates2 1
d wrk_day 2
d Wrk_DateC s 10
* 18/10/22 - 2018/10/22
D Dtymd s D DATFMT(*YMD)
* 10/22/18 - 2018/10/22
D Dtusa s D DATFMT(*USA)
* 2018-10-22 - 2018/10/22
D Dtiso s D datfmt(*ISO)
C EVAL vdate = %date()
C move vdate wrk_date
/Free
Dsply %Char(%Date());
vdate = %date();
wrk_date = %char(vDate);
Dtymd = %date() - %days(1);
Dtusa = %date() - %days(1);
Dtiso = %date() - %days(1);
Wrk_Datec = %Char(DtIso);
Dow %Scan('-':Wrk_DateC) <> 0;
Wrk_DateC = %Replace('/':Wrk_DateC:%Scan('-':Wrk_DateC));
EndDo;
dsply Wrk_Cent;
dsply Wrk_Year;
dsply Wrk_Month;
dsply Wrk_Day;
dsply %Char(Udate);
Return;
Comments
Post a Comment