根据日期计算星期

 

函数名称:  CalulateWeek 
函数功能:  计算星期几 
输入参数∶ lConfirmDateCal 
输出参数∶ 返回0-6(分别是周日,周一至周六) 
返 回 值∶ 无 
说    明∶根据基姆拉尔森计算公式计算 
******************************************************************************/  
int CalulateWeek(int lConfirmDateCal)  
{  
     int year=lConfirmDateCal/10000;  
     int month=lConfirmDateCal/100-(lConfirmDateCal/10000)*100;  
     int day=lConfirmDateCal%100;  
     int daynum;  
     if(month>2)  
     {  
        
     daynum=(day+1+2*month+3*(month+1)/5+year+year/4-year/100+year/400)%7;  
        
     }  
     else  
     {  
     year=year-1;  
     month=month+12;  
       daynum=(day+1+2*month+3*(month+1)/5+year+year/4-year/100+year/400)%7;  
     }  
      
    return daynum;  
}  
  


 



你可能感兴趣的:(根据日期计算星期)