判断当前月有多少天

    xiaoxiao2021-03-25  197

    如下代码

    //获取月份天数 int GetMonthDayCount(int year,int month) { switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: { return 31; } case 4: case 6: case 9: case 11: { return 30; } case 2: { if(year%4) { return 28; } else { if(year0) { return 29; } else { if(year@0) { return 28; } else { return 29; } } } } default: { return 0; } } }

    转载请注明原文地址: https://ju.6miu.com/read-4373.html

    最新回复(0)