修复闰年判断错误的问题

This commit is contained in:
xtaodada 2021-10-31 22:37:58 +08:00
parent 2a6c52c460
commit 9dd4e96f20
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736

View File

@ -3,9 +3,9 @@
int month2day(int year,int month){ int month2day(int year,int month){
int tmp[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; int tmp[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
if (year % 4 == 0)tmp[1]++; if(((year%4==0) && (year%100!=0)) || year%400==0)tmp[1]++;
return tmp[month-1]; return tmp[month-2];
} }
int main(){ int main(){