判断一年中某一天是这一年的第几天的函数接口

来源:互联网 发布:java如何 私有构造方法 编辑:程序博客网 时间:2024/06/05 05:08
#define ret_ok  0#define ret_err 1int a[] = {31, 28, 31, 30, 31, 30, 31,31, 30, 31, 30, 31};int judge_day(int Year, int Month, int Day, int *result_day){    int Total = 0;    int i = 0;    if( (((Year%400) == 0) || ((Year%4) == 0)) && ((Year %100) != 0))//如果是闰年,那么2月份为29天    {        a[1] = 29;    }    for(i=0;i<Month-1;i++)    {        Total += a[i];    }    Total += Day;    *result_day = Total;    return ret_ok;}
1 0
原创粉丝点击