Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Holidays 3

Status
Not open for further replies.

brownb1

Programmer
Jul 11, 2002
11
US
Anyone have a program to calculate holidays?
 
Do a keyword search in this forum for 'holiday' and you will find several threads on this topic.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
brownb1, if you would ever respond to your post you would probably get better responses. see faq222-2244

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
ahh, just for that I'm going to give you Memorial Day.

Private Function GetMemorialDay(strYear As String) As Date
Dim tmpDate As Date
tmpDate = "5/1/" & strYear
Select Case Weekday(tmpDate)
Case 1
GetMemorialDay = "5/30/" & strYear
Case 2
GetMemorialDay = "5/29/" & strYear
Case 3
GetMemorialDay = "5/28/" & strYear
Case 4
GetMemorialDay = "5/27/" & strYear
Case 5
GetMemorialDay = "5/26/" & strYear
Case 6
GetMemorialDay = "5/25/" & strYear
Case 7
GetMemorialDay = "5/31/" & strYear
End Select
End Function

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
I'm assuming your from the United States and you are only interested in the US big 6. Well Christmas, New Years and 4th of July are obvious and you already have Memorial day, so here's labor day and thanksgiving:

Private Function GetThanksgiving(strYear As String) As Date
Dim tmpDate As Date
tmpDate = "11/1/" & strYear
Select Case Weekday(tmpDate)
Case 1
GetThanksgiving = "11/26/" & strYear
Case 2
GetThanksgiving = "11/25/" & strYear
Case 3
GetThanksgiving = "11/24/" & strYear
Case 4
GetThanksgiving = "11/23/" & strYear
Case 5
GetThanksgiving = "11/22/" & strYear
Case 6
GetThanksgiving = "11/29/" & strYear
Case 7
GetThanksgiving = "11/28/" & strYear
End Select
End Function
Private Function GetLaborDay(strYear As String) As Date
Dim tmpDate As Date
tmpDate = "9/1/" & strYear
Select Case Weekday(tmpDate)
Case 1
GetLaborDay = "9/2/" & strYear
Case 2
GetLaborDay = "9/1/" & strYear
Case 3
GetLaborDay = "9/7/" & strYear
Case 4
GetLaborDay = "9/6/" & strYear
Case 5
GetLaborDay = "9/5/" & strYear
Case 6
GetLaborDay = "9/4/" & strYear
Case 7
GetLaborDay = "9/3/" & strYear
End Select
End Function

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top