Re: Figuring Instances of a Day by Chris
Chris
Fri Dec 05 18:21:14 CST 2003
Michael, that worked like a champ. Thanks,
Chris
"Michael Dunn" <returnToSpammer@hisDomain.com> wrote in message
news:evw$ImfuDHA.2448@TK2MSFTNGP12.phx.gbl...
>
> "Chris Guimbellot" <cguimbellot@FORGETSPAM.hifranchise.com> wrote in
message news:uATYjqeuDHA.1872@TK2MSFTNGP09.phx.gbl...
> : Hello,
> :
> : This is probably a pretty easy question, but what I am trying to do is
> : figure out what instance of a day each day is in a particular month.
> :
> : For example:
> :
> : Today is Wednesday. I know its the first Wednesday of the month. I would
> : like the script to be able to tell me that it is the 1st Wednesday (or
the
> : 2nd, 3rd, 4th, or 5th) of the current month.
> :
> : I'm probably not explaining this so if necessary, I can further clarify.
I
> : appreciate the help. Thanks,
> :
> : Chris
>
> try this (needs testing)
>
>
> dim dt, dy, weekOfMonth,arr
> arr = Array("","st","nd","rd","th","th")
> dt = dateserial(2003,12,3) 'or dt = Date()
> dy = day(dt)
> weekOfMonth = dy\7
> if dy mod 7 > 0 then weekOfMonth = weekOfMonth + 1
> msgbox dt & " is the " & weekOfMonth & arr(weekOfMonth) & " " _
> & weekdayname(weekday(dt)) & " in " & monthname(month(dt))
>
>