285 pts.
 Opcode in RPG that retrieves current date
Which opcode in RPG can be used to retrieve current date along with century?

Software/Hardware used:
ASKED: December 14, 2007  5:49 AM
UPDATED: June 14, 2013  4:25 PM

Answer Wiki:
The TIME opcode with a 14-digit result field, the %DATE built-in, or the %TIMESTAMP built-in are three that come to mind. ================================================== The DATE positions 191-198 of the program status data structure provides a 4-digit year. Tom
Last Wiki Answer Submitted:  June 14, 2013  4:25 pm  by  Michael Tidmarsh   14,000 pts.
All Answer Wiki Contributors:  Michael Tidmarsh   14,000 pts. , bvining   6,055 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 
 35 pts.

 

This will return today’s date as CYYMMDD. Just modify the *CYMD0 parm to get other date formats.

D Today70 S 7 0

C/Free
Today70 = %int(%char(%date():*CYMD0)) ;

 5,555 pts.

 

at V5R3+

Today70 = %dec(%date():*CYMD0) ;

 7,205 pts.

 

To expand slightly on the examples provided:

D ISO  S  8 0 

ISO = %dec(%date():*ISO0) ;

Assuming you’re looking for the full, four digit year.

 5,730 pts.