const char *DayOfWeek[] =
{
"Sun","Mon","Tue","Wed","Thu","Fri","Sat"
}; //对应下标
int Zeller(int year,int month,int day)
{
int c=year/100;
int y=year%100;
int m=month;
int d=day;
if(m<3)
{
m+=12;
y--;
}
int w=y+y/4+c/4-2*c+13*(m+1)/5+d-1;
w=(w%7+7)%7;
return w;
}
使用 Zeller 公式计算 DayOfWeek
最新推荐文章于 2021-08-25 10:40:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)