首页 > 其他 > 详细

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

时间:2015-08-11 01:27:49      阅读:242      评论:0      收藏:0      [点我收藏+]
#define ret_ok  0
#define ret_err 1

int 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;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

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

原文:http://blog.csdn.net/u014100559/article/details/47406275

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!