This function identifies the first day of week based on a particular date.
Example:
Sending 01.01.2010 will return 28.12.2009.
M | T | W | T | F | S | S
28 29 30 31 1 2 3
First date in same week as 01.01.2010 date, is 28.12.2009.
Private Function FirstDateOfWeek(ByVal dayInWeek As Date) As Date
<br />
Dim Days As Integer = dayInWeek.DayOfWeek - CurrentCulture.DateTimeFormat.FirstDayOfWeek
<br />
Days = (7 + Days) Mod 7
<br />
Return dayInWeek.AddDays(-Days)
End Function