By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

How do I find next Tuesdays date?

P: 1
I need code to find next Tuesdays date.

I have started with this:

TuesdaysDate = DateAdd("d", vbTuesday - Weekday(Date), Date)

However if today is Wednesday it returns yesterdays date. I need to find next Tuesday's date.

Can anyone help?
Jul 7 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
Try this...
Expand|Select|Wrap|Line Numbers
  1. TuesdaysDate = Now + (8 - Weekday(Now, vbTuesday))
  2. ' Or, to adjust your version...
  3. TuesdaysDate = DateAdd("d", 8 - Weekday(Now, vbTuesday), Now)
  4.  
This is written for VB6 and assuming the current date. You may need to adjust it for your purposes. Since it's working with Now, I suppose it is really giving the time on Tuesdaym, not just the date. But the "8 - Weekday" construction appears to work, anyway. The trick is to tell the function that the week starts in Tuesday (the second parameter).
Jul 10 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.