Public Function GetWeeksInYear(ByVal dayofsunday As DateTime) As Integer
Dim dayofthursday As DateTime = dayofsunday.AddDays(-3)
Dim yearno As Integer = dayofthursday.Year
Dim firstday As DateTime = "01-Jan-" & yearno.ToString
Dim totalweeks As Integer = 0
If firstday.DayOfWeek = DayOfWeek.Thursday Then
totalweeks = 53
ElseIf Date.IsLeapYear(yearno) = True _
And firstday.DayOfWeek = DayOfWeek.Wednesday Then
totalweeks = 53
Else
totalweeks = 52
End If
Return totalweeks
End Function
"I have not failed. I've just found 10,000 ways that won't work."
--Thomas Edison
"Not everything that can be counted counts, and not everything that counts can be counted."
--Albert Einstein
"If you can't make it good, at least make it look good."
"Your most unhappy customers are your greatest source of learning."
--Bill Gates
No comments:
Post a Comment