Calculating date

1. Martin Guest

## Calculating date

I&#039m desesperatly looking for help for the following problem: How do i calculate, for example, the second tuesday of every upcoming month!<BR><BR>Thanx!

2. XPost Rebel Guest

## RE: Calculating date

&#060;%<BR>dtFirstnxtmth= DateSerial(Year(date()),Month(Date())+1, 1) &#039 find first day of next month<BR>wday = WeekDay(dtFirstnxtmth)<BR>If wday &#060; vbTuesday then <BR>&nbsp;&nbsp;&nbsp;&nbsp;dy = vbTuesday - wday + 7<BR>else <BR>&nbsp;&nbsp;&nbsp;&nbsp;dy = 14 - (wday - vbTuesday)<BR>End if<BR>SecondTuesNxtMth = DateSerial(Year(dtFirstnxtmth),Month(dtFirstnxtmth ), dy+1)<BR>%&#062;<BR><BR>

3. Member
Join Date
Dec 1969
Posts
62

## RE: Calculating date

One minor error in your code.. the line<BR>If wday &#060; vbTuesday then <BR>should read<BR>If wday &#060;= vbTuesday then<BR><BR>or the it will return an incorrect result when Tuesday is the first day of the month. Change that one piece and it should work great!

4. Martin Guest

## RE: Calculating date

Thank you for finding a solution!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•