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

Create a string with previous day's date 2

Status
Not open for further replies.

TMurdach

IS-IT--Management
Apr 18, 2003
61
US
All,

I am looking for a way to always insert the previous day's date into a string in the format 03172005.

My automated nightly reports have to run after midnight, and since the current date is populated into the date field automatically, I need a way to populate the previous day's date.

Thank you.
 
Here's a modfied copy of a sample from my site that should do the job. The trick is subtracting 86400 (the number of seconds in a day) from the current time value in $LTIME, then using %02d in the format string of the strfmt command to force two digits for the day and month:

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

ltimeints $LTIME-86400 iYear iMonth iDay iHour iMin iSec

strfmt sDate "%02d%02d%d" iMonth iDay iYear
endproc


 
knob,

It worked, like all your other suggestions do!

Thanks again...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top