dayofweek(m, d, y) /* 1 <= m <= 12, y > 1752 (in the U.K.) */
{
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;
}
/*
dow(m,d,y){y-=m<3;return(y+y/4-y/100+y/400+"-bed=pen+mad."[m]+d)%7;}
This is not portable, but easy to learn by heart.
*/
--
T. Sakamoto
Of course, you could always use the standard library function mktime(
).
--
Stan Brown, Oak Road Systems br...@Ncoast.ORG
Richard Harding Davis said, "I never talk about things when I don't know
the facts." Replied Oscar Wilde, "That, my dear fellow, must limit your
conversation frightfully!"