|
|
|
Click here to copy the following block |
Public Function Monday(intYear As Integer, intWeek As Integer) As Date Static intMonday(53) As Date Dim i As Long, x As Integer Dim datDayNum As Date Dim intNumDays As Integer
If IsLeapYear(intYear) Then intNumDays = 365 Else intNumDays = 364 End If
datDayNum = DateSerial(intYear, 1, 1)
If WeekDay(datDayNum) >= 3 And WeekDay(datDayNum) <= 6 Then For i = datDayNum - 7 To datDayNum + intNumDays If WeekDay(i) = 2 Then x = x + 1 intMonday(x) = CDate(i) End If Next Else For i = datDayNum To datDayNum + intNumDays If WeekDay(i) = 2 Then x = x + 1 intMonday(x) = CDate(i) End If Next End If Monday = intMonday(intWeek) End Function
Public Function IsLeapYear(intYear As Integer) As Boolean
If intYear < 100 Or intYear > 9999 Then MsgBox "The year provided must be between 100 and 9999, inclusive." Exit Function End If
If intYear Mod 400 = 0 Then IsLeapYear = True ElseIf intYear Mod 100 = 0 Then IsLeapYear = False ElseIf intYear Mod 4 = 0 Then IsLeapYear = True Else IsLeapYear = False End If End Function |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|