Files
libucore/src/dayofweek.c
T
2013-03-06 22:22:04 +01:00

19 lines
322 B
C

int
uc_day_of_week(int day, int month, int year)
{
int cent;
/* adjust months so February is the last one */
month -= 2;
if (month < 1) {
month += 12;
--year;
}
/* split by century */
cent = year / 100;
year %= 100;
return ((26 * month - 2) / 10 + day + year
+ year / 4 + cent / 4 + 5 * cent) % 7;
}