C++ 根据日期判断星期几

int CaculateWeekDay(int y,int m, int d)
{
    if(m==1||m==2) {
        m+=12;
        y--;
    }
    int iWeek=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;
    return iWeek + 1;
} 

 

posted @ 2015-11-27 16:44  QQ76211822  阅读(2142)  评论(0编辑  收藏  举报