Write a function that calculates the day of the week for any particular date in the past or future. A typical application is to calculate the day of the week on which someone was born or some other special event occurred.
http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week
Read full article from Find day of the week for a given date | GeeksforGeeks
int
dayofweek(
int
d,
int
m,
int
y)
{
static
int
t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
y -= m < 3;
return
( y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
}
Read full article from Find day of the week for a given date | GeeksforGeeks