Member_2_5230414
asked on
getting last monday of the month
I have some code to get the first monday of each month
how could i reverse this to get the LAST monday of each month?
Shared Function EarlyMay(ByVal theYear As Integer) As Date
'first Monday in May
Dim Dte As Date = New Date(theYear, "05", 1)
Do While Dte.DayOfWeek <> DayOfWeek.Monday
Dte = Dte.AddDays(1)
Loop
Return Dte
End Function
how could i reverse this to get the LAST monday of each month?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Shared Function EarlyMay(ByVal theYear As Integer) As Date
'first Monday in May
Dim Dte As Date = New Date(theYear, "05", DateTime.DaysInMonth(theYe
Do While Dte.DayOfWeek <> DayOfWeek.Monday
Dte = Dte.AddDays(-1)
Loop
Return Dte
End Function