Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Date Manipulation to Get Previous Day

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,31
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Date Manipulation to Get Previous Day
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Date Manipulation to Get Previous Day - 5/23/2001 6:30:03 AM   
  rahul27

 

Posts: 19
Score: 0
Joined: 5/23/2001
From: India
Status: offline
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!
 
 
Post #: 1
 
 Re: Date Manipulation to Get Previous Day - 5/23/2001 6:31:44 AM   
  rhl150

 

Posts: 29
Score: 0
Joined: 5/23/2001
From: New Zealand
Status: offline
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)

(in reply to rahul27)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Date Manipulation to Get Previous Day Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts