Third saturday of the month

# Thread: Third saturday of the month

1. Senior Member
Join Date
Dec 1969
Posts
136

## Third saturday of the month

Can anyone help me with this.<BR><BR>I am trying to do two things.<BR>First, test a date to see if it is the 1st,2nd,3rd or 4th saturday of the month.<BR><BR>Second, find out what the 3rd saturday of a different month would be.<BR><BR>To clarify a bit. I am working on an event calendar and I want to find out which saturday of the month the start date is on and then show that event on the 3rd saturday of every month.

2. Senior Member
Join Date
Dec 1969
Posts
1,936

## RE: Third saturday of the month

try looking here http://www.devguru.com/Technologies/vbscript/quickref/datepart.html<BR><BR>you can also do a Google search for more help on the DatePart function

3. Senior Member
Join Date
Dec 1969
Posts
136

## Yeah, Ive been here...

Maybe its just late in the day but I just cant figure this out.<BR><BR>Yes you can use datepart to pull out the day of the month but I cant seem to translate that into 3rd saturday or 1st sunday.<BR><BR>It seems like you would also need to figure what day of the week the 1st would be and then do some kind of math to see what your date is.<BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
6,476

## RE: Yeah, Ive been here...

It seems like you would also need to figure what day of the week the 1st would be and then do some kind of math to see what your date is.<BR><BR>IF you know what day the 1st falls on<BR>then you know how many days it will be to the first saturday...<BR>and the 3rd saturday is only 14 more days from there...<BR><BR>Your right, its just math.

5. Senior Member
Join Date
Dec 1969
Posts
1,936

## RE: Yeah, Ive been here...

&#060;%dim thisMonth, thisYear, FirstDay, BeginMonth, ThirdSat<BR>&#039;get current month and year<BR>thisMonth = month(now) &#039;you could also use user-defined variables<BR>thisYear = year(now) &#039;you could also use user-defined variables<BR><BR>&#039;create the 1st of the month<BR>BeginMonth = thisMonth & "/01/" & thisYear<BR>&#039;The third Saturday would be(according to a calender) the 21st day (7 days * 3 weeks). Subtract the returned number from the datepart function from 21, then add the result to the Beginning date.<BR>FirstDay = 21 - datepart("W", BeginMonth)<BR>ThirdSat = DateAdd("d", FirstDay, BeginMonth)<BR>response.write ThirdSat<BR>%&#062;

6. Senior Member
Join Date
Dec 1969
Posts
6,476

## RE: Yeah, Ive been here...

&#060;%<BR>TT = CDate(Month(now()) & "/" & Year(Now()))<BR>TT = (TT + ( (7 - WeekDay(TT) ) + 14 ))<BR>Response.Write TT<BR>%&#062;<BR><BR><BR>Also works.

#### Posting Permissions

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