您的位置:首页 > 其它

根据年和月获取当月天数的函数

2014-03-05 21:13 204 查看
int getDaysByYearAndMonth(int year, int month)
   {
	   int result;
	   if (2==month)
	   {
		   if(year%4==0&&year%100!=0||year%400==0){
				result=29;
		   }else{
				result=28;
		   }
	   }
	   else if (month==4||month==6||month==9||month==11)
	   {
		   result=30;
	   }
	   else{
		   result=31;
	   }
	   return result;
   }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: