Here is a quick way to get the first day of the current week.
If you are happy with sunday as the first day of the week, then you can simply do this :
public static DateTime FirstDayOfWeek(this DateTime date)
{
return DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek);
}
But if you want that the first day of the week matches your culture (eg: the belgian week starts on monday), you have to take care of the culture’s DateTime format.
So the method will change a bit :
public static DateTime FirstDayOfWeek(this DateTime date)
{
return DateTime.Today.AddDays(-((int)DateTime.Today.DayOfWeek - (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek));
}
Usage :
DateTime FirstDayOfWeek = DateTime.Today.FirstDayOfWeek();
or
DateTime FirstDayOfWeek = DateTime.Now.FirstDayOfWeek();





