UINT8 MMI_GetWeekday(int rlYear, int rlMonth, int rlDay)
{
int a, y, m, d, temp, temp1, temp2, temp3;
a = (14 - rlMonth) / 12;
y = rlYear - a;
m = rlMonth + (12 * a) - 2;
temp3 = rlDay + y + (y / 4);
temp = y / 100;
temp1 = y / 400;
temp2 = (31 * m) / 12;
d = temp3 - temp + temp1 + temp2;
/* for alarm's week checking by chip, MMI needs to get a special week day,
according to the week day of MMI_START_YEAR's 1/1. That day's week day should be 0 */
//d = (d + 1) % 7;
/* normal week day should be d = d % 7;*/
d %= 7;
return d;
}
阅读(1053) | 评论(0) | 转发(1) |