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

Date Manipulation to Get Previous Day 1

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

Does anyone know of function to manipulate today's date to obtain yesterday's date?

For example, in my code I use the Date keyword which returns 5/11/01. However, I'd like to have 5/10/01. I realize that if a function doesn't exist, I'll have to subtract 1 from my DD and then use the MM to determine the number of days for a particular month, etc., but if there's an easier way, I thought I'd ask.

Thanks in advance for all the cool help!
scripter73
 
so you have a variable of subType date called, 'theDate' -- do this to take a day off and place the results into 'theNewDate'--

theNewDate = DateAdd("D", -1, theDate)

:)
Paul Prewett
 
Hi Paul!

That worked great! You're the best!

scripter73
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top