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

Re: Figuring Instances of a Day by Michael

Michael
Wed Dec 03 18:02:09 CST 2003


"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))



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))
>
>



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))
>
>



Re: Figuring Instances of a Day by Torgeir

Torgeir
Thu Dec 04 08:50:11 CST 2003


Please fix the date on your computer...


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: Figuring Instances of a Day by Chris

Chris
Thu Dec 04 12:14:52 CST 2003

Sorry. When I was testing the script, I kept changing the date to make sure
it worked. I must have sent the message before I sent the message. Sorry.

Chris

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3FCF49A3.5FC7BB72@hydro.com...
>
> Please fix the date on your computer...
>
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>
>


<