Okay; I have this great script I added to our logon script that will tell if
it is the day to turn in your timesheet (every other friday). What I would
like to do is either augment this one or use another one that I can use on
our website to determine when the next date to turn in your timesheet is or
the next pay date (which is the opposite friday). Is there an easy way to
calculate what the next one is? I assume it is some do until statement, but
am unsure. If the formula works correctly, the output should be July 2,
2004 if ran right now

' use ISO date format yyyy-mm-dd so it is unambiguous!
sFirstFriday = "2003-04-25"

If Weekday(Now) = vbFriday Then

iDeltaWeeks = DateDiff("w", sFirstFriday, Now)
iEvenOdd = iDeltaWeeks Mod 2
If iEvenOdd = 0 Then
MsgBox "Remember to complete your time sheet today and turn it into to
your supervisor", vbOKOnly + vbExclamation, "Reminder"
End If
End If

--
Robert Cohen
A legend in his own mind
--

Re: Next Every Other Friday by Robert

Robert
Wed Jun 23 13:28:49 CDT 2004

okay figured it out:

' use ISO date format yyyy-mm-dd so it is unambiguous!
sFirstFriday = "2004-06-18"
Testdate= Now
IEvenOdd= 1
Do
Do
If Weekday(Testdate) = vbFriday Then

iDeltaWeeks = DateDiff("w", sFirstFriday, Testdate)
iEvenOdd = iDeltaWeeks Mod 2
If iEvenOdd = 0 Then
MsgBox (Testdate)
Exit Do
End If
End If

testdate= dateadd("d", testdate, 1)
Loop Until weekday(testdate)= vbFriday
Loop Until iEvenOdd = 0

--
Robert Cohen
A legend in his own mind
--

"Robert Cohen" <dont@want.spam.com> wrote in message
news:epCKUBTWEHA.3024@TK2MSFTNGP09.phx.gbl...
> Okay; I have this great script I added to our logon script that will tell
if
> it is the day to turn in your timesheet (every other friday). What I
would
> like to do is either augment this one or use another one that I can use on
> our website to determine when the next date to turn in your timesheet is
or
> the next pay date (which is the opposite friday). Is there an easy way to
> calculate what the next one is? I assume it is some do until statement,
but
> am unsure. If the formula works correctly, the output should be July 2,
> 2004 if ran right now
>
> ' use ISO date format yyyy-mm-dd so it is unambiguous!
> sFirstFriday = "2003-04-25"
>
> If Weekday(Now) = vbFriday Then
>
> iDeltaWeeks = DateDiff("w", sFirstFriday, Now)
> iEvenOdd = iDeltaWeeks Mod 2
> If iEvenOdd = 0 Then
> MsgBox "Remember to complete your time sheet today and turn it into to
> your supervisor", vbOKOnly + vbExclamation, "Reminder"
> End If
> End If
>
> --
> Robert Cohen
> A legend in his own mind
> --
>
>



Re: Next Every Other Friday by Dr

Dr
Wed Jun 23 16:59:12 CDT 2004

JRS: In article <epCKUBTWEHA.3024@TK2MSFTNGP09.phx.gbl>, seen in
news:microsoft.public.scripting.vbscript, Robert Cohen
<dont@want.spam.com> posted at Wed, 23 Jun 2004 10:42:35 :
>Okay; I have this great script I added to our logon script that will tell if
>it is the day to turn in your timesheet (every other friday). What I would
>like to do is either augment this one or use another one that I can use on
>our website to determine when the next date to turn in your timesheet is or
>the next pay date (which is the opposite friday). Is there an easy way to
>calculate what the next one is? I assume it is some do until statement, but
>am unsure. If the formula works correctly, the output should be July 2,
>2004 if ran right now
>
>' use ISO date format yyyy-mm-dd so it is unambiguous!
>sFirstFriday = "2003-04-25"
>
>If Weekday(Now) = vbFriday Then
>
> iDeltaWeeks = DateDiff("w", sFirstFriday, Now)
> iEvenOdd = iDeltaWeeks Mod 2
> If iEvenOdd = 0 Then
> MsgBox "Remember to complete your time sheet today and turn it into to
>your supervisor", vbOKOnly + vbExclamation, "Reminder"
>End If
>End If

That script is unnecessarily long; you only need to form the difference
in daycount between today and the First Friday, and issue your threat if
Diff mod 14 is 0. (* Then if Diff mod 14 is 13, you can warn Timesheet
Tomorrow and if Diff mod 14 is >0 & <=3 you can say If Timesheet Not
Done, Panic Now. *)

The next Timesheet date can be determined by adding something like 14 -
(Diff mod 14) to today; the next pay day by adding seven more mod 14.

You need to decide whether, on an odd Friday, the next pay day is today
or a fortnight hence.

You do not need to loop through days.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.