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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transmit yesterdays date in a script 1

Status
Not open for further replies.

speboy

Programmer
Joined
Mar 28, 2008
Messages
2
Location
US
I have a script that runs everyday and I need to transmit the date from the day before and the format needs to be like 03/28/08.

Thanks
 
What have you tried so far, and where in your code are you stuck?
 
The below script shows how to get yesterday's date by subtracting 86400 from the current timeval (86400 is the number of seconds in a day), breaking down the individual components, and then building the date string:

proc main
integer iDay, iMonth, iYear, iHour, iMin, iSec
string sDate

ltimeints $LTIME-86400 iYear iMonth iDay iHour iMin iSec ;Convert timeval to integer components
iYear = iYear - 2000
strfmt sDate "%02d/%02d/%02d" iMonth iDay iYear ;Create MMDDYY string
endproc

 
Thank You knob. That's exactly what I needed. Sorry it took so long to reply I had neck surgery and have been out of it for awhile.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top