<sw**********@yahoo.comwrote in message
news:11**********************@z28g2000prd.googlegr oups.com...
Hi,
I wonder if there is any function in VB or SQL that will return the
date of first Monday of the Monday.
The first Monday of Monday? I assume you mean the first Monday of the month
:D I am pretty sure there is, but I don't remember..maybe it is SQL that I
remember having such a method....
Besides, is there are a way finding the numbers of Monday in a month?
The following should work for ya.
Private Function GetDayOfWeekCountForMonth( _
ByVal Month As Integer, _
ByVal Year As Integer, _
ByVal DayOfWeek As DayOfWeek _
) As Integer
Dim count As Integer = 0
Dim d As Date = New Date(Year, Month, 1)
While d.Month = Month AndAlso d.Year = Year
If d.DayOfWeek = DayOfWeek
count += 1
d = d.AddDays(7)
Else
d = d.AddDays(1)
End If
End While
Return count
End Function