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!

Basedate and Maths

Status
Not open for further replies.

CDMZZZ

Technical User
Jan 30, 2008
4
GB
Hi
I want to strip a date from a file in standard format
convert it to a Basedate to perform some Math on it and then convert back to the new date in standard format.
Does anyone know if this is possible in Rexx and if so how to do it.
Thanks
 
Here are 2 examples of adding 30 days to a date

FileDate = '2008/01/30'
parse var FileDate yyyy '/' mm '/' dd
say FileDate '+30=' date('S',date('B',yyyy||mm||dd,'S')+30,'B')
/* OR */
StndDate = yyyy||mm||dd
BaseDate = date('B',StndDate,'S')
Date#30 = date('S',BaseDate + 30,'B')
say FileDate '+30=' Date#30
 
For reshaping data (especially dates) I prefer 'Translate':
Code:
s_date  =  Translate( "CcYyMmDd" , "01/30/2008" , "Dd/Mm/CcYy" )


Frank Clarke
Support the Troops:
-- Bring them home.
 
Thanks for the info
Can I also convert the basedate to a day of the week
eg. Monday
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top