November 20, 2009

WinTask - DayOfDate()



'
' DayOfDate - Return the day number for a given date
'
' Author - Joe Strazzere
'

Function DayOfDate(TargetDate$)
    Local DayNumber
    DayNumber =((Weekday() + DateBetween("d",Date$(),TargetDate$)) mod 7)
    If DayNumber < 1 then
        DayOfDate = DayNumber + 7
    Else
        DayOfDate = DayNumber
    EndIf
EndFunction

TargetDate$="11/21/2009"
TargetDay=DayOfDate(TargetDate$)
MsgBox(TargetDate$+" was a "+Str$(TargetDay))