Here is a quick way to find out how many times a particular day of the week occurs between two dates.
For example, how many sundays between two dates.
Protected Function findWeekDays(ByVal startDate As Date, ByVal endDate As Date, ByVal DayOfWeek As Microsoft.VisualBasic.FirstDayOfWeek) As Integer Dim Resp As Integer Resp = DateDiff("ww", startDate, endDate, DayOfWeek) If Weekday(startDate) = DayOfWeek Then Resp += 1 Return Resp End Function
Thanks! I found this in C# but no one had a VB version. Worked great in Reporting Services. You saved me a call to the database.
Excellent – just what I wanted – Good one. Cheers