Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REXX Get last two digits of the year 1

Status
Not open for further replies.

Jongskie M.

Technical User
Dec 30, 2023
24
AE
Hi,
I would like to display the last two digits of the year from the code below, please amend, thx

Code:
ystrday = date('s',(date('b')-1,'b')
CALL ZocSend "RE"||ystrday"||" ^M"

RE20240208
Am expecting a result of RE240208
 
mikrom (Programmer)
use
Code:
substr(ystrday,3)

hi mikrom, how about this format 08022024 <--DDMMYYYY
 
you can use the substr() function
Code:
yyyymmdd = date('s')
say(yyyymmdd)

ddmmyyyy = substr(yyyymmdd,7,2)||substr(yyyymmdd,5,2)||substr(yyyymmdd,1,4)
say(ddmmyyyy)

Output
Code:
20240209
09022024

Here is a good tutorial for learning basics of REXX. There have online interpreter, where you can try out your code snippets
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top