| iMatix home page | << | < | > | >> |
SFL Version 2.11 |
#include "sfldate.h" int day_of_week (long date)
Returns the day of the week where 0 is Sunday, 1 is Monday, ... 6 is Saturday. Uses Zeller's Congurence algorithm.
{ int year = GET_CCYEAR (date), month = GET_MONTH (date), day = GET_DAY (date); if (month > 2) month -= 2; else { month += 10; year--; } day = ((13 * month - 1) / 5) + day + (year % 100) + ((year % 100) / 4) + ((year / 100) / 4) - 2 * (year / 100) + 77; return (day - 7 * (day / 7)); }
| << | < | > | >> | Copyright © 1996-2000 iMatix Corporation |