Try this
public static int WeekDay(DateTime dt)
{
int yyyy = dt.Year;
int mm = dt.Month;
int dd = dt.Day;
int DayOfYearNumber;
int Jan1WeekDay;
int WeekDay;
int i, j, k, l;
int[] Mnth = new int[12] { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
DayOfYearNumber = dd + Mnth[mm - 1];
if ((IsLeapYear(yyyy) == true) && (mm == 2))
DayOfYearNumber += 1;
i = (yyyy - 1) % 100;
j = (yyyy - 1) - i;
k = i + i / 4;
Jan1WeekDay = 1 + (((((j / 100) % 4) * 5) + k) % 7);
l = DayOfYearNumber + (Jan1WeekDay - 1);
WeekDay = 1 + ((l - 1) % 7);
return WeekDay;
}
public static bool IsLeapYear(int yyyy)
{
if ((yyyy % 4 == 0 && yyyy % 100 != 0) || (yyyy % 400 == 0))
return true;
else
return false;
}
http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/bf504bba-85cb-492d-a8f7-4ccabdf882cb[
^]