## Some Day Of The Week Calculation Functions

Here are a few Day of the Week calculation functions I wrote when someone asked for help. Enjoy:

'
' 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 &lt; 1 then
DayOfDate = DayNumber + 7
Else
DayOfDate = DayNumber
EndIf
EndFunction

TargetDate\$="11/21/2009"
TargetDay=DayOfDate(TargetDate\$)

MsgBox(TargetDate\$+" was a "+Str\$(TargetDay))

--------------------------------------------------------

'
' DayOfDate\$ - Return the day of the week for a given date
'
' Author - Joe Strazzere

Function DayOfDate\$(TargetDate\$)
Local DayOfDate

DayOfDate =((Weekday() + DateBetween("d",Date\$(),TargetDate\$)) mod 7)
If DayOfDate &lt; 1 then
DayOfDate = DayOfDate + 7
EndIf
Select Case DayOfDate
Case 1
DayOfDate\$ = "Sunday"
Case 2
DayOfDate\$ = "Monday"
Case 3
DayOfDate\$ = "Tuesday"
Case 4
DayOfDate\$ = "Wednesday"
Case 5
DayOfDate\$ = "Thursday"
Case 6
DayOfDate\$ = "Friday"
Case 7
DayOfDate\$ = "Saturday"
Case Else
DayOfDate\$ = "I'm lost. I don't know what day "+Str\$(DayOfDate)+" is."
EndSelect
EndFunction

TargetDate\$="11/29/1954"
TargetDay\$=DayOfDate\$(TargetDate\$)

MsgBox(TargetDate\$+" was a "+TargetDay\$)