Public Function GetholiDays(ByVal theYear As Integer, ByVal theMonth As Integer) As Integer
Dim theDays As Integer = 8
Dim x, y As Integer
Dim dt As New DateTime(theYear, theMonth, 1)
x = DateTime.DaysInMonth(theYear, theMonth) - 28
If dt.DayOfWeek.ToString() = "Monday" Then y = 1
If dt.DayOfWeek.ToString() = "Tuesday" Then y = 2
If dt.DayOfWeek.ToString() = "Wendnesday" Then y = 3
If dt.DayOfWeek.ToString() = "Thursday" Then y = 4
If dt.DayOfWeek.ToString() = "Friday" Then y = 5
If dt.DayOfWeek.ToString() = "Saturday" Then y = 6
If dt.DayOfWeek.ToString() = "Sunday" Then y = 7
If x + y = 7 Then
theDays = 9
ElseIf x + y >= 8 Then
theDays = 10
End If
If y = 7 Then theDays = theDays - 1
Return theDays
End Function
沒有留言:
張貼留言