在VC++ 中 怎么样得到 某年某月的天数 是多少天呢?? 例如2008年11月份 是30天2006年2月是28 求现成的函数!!! 谢谢? 其他方法也可以
解决方案 »
- 使用CFlexGrid怎么老是出错啊????
- 匿名管道 CMD
- 如何显示多个图标,求一算法 紧急!!!
- 帮帮忙,看看我的程序哪儿出了问题?m_Edit4获得的信息总是不对!
- 防止ARP攻击
- 100分求解RPC问题
- mfc寫的控件放在網頁上,在客戶端總下載安裝不了
- 哪有Visual Studio 6 英文企业版下载阿!!!急急急!!!!
- 在windows nt或在windows 2000下为什么要调用函数InitCommonControls系统才加载程序?
- 如何实现点击一个对话框的按钮能将数据库的数据显示在单文档生成的属性页输入框内。
- Debug与Release
- ????Windows2000虚存管理 怎样在VC++6.0中实现动态图象(涉及到线程)
{
case 1:
return 31;
case 2:
if (闰年)
return 29;
else
return 28;
case 3:
// ...
case 12:
return 31;
}
COleDateTime d2(2006,12,1,0,0,0);
COleDateTimeSpan ds = d2-d1;
cout<<ds.GetDays();
int month_day2[12]={31,29,31,30,31,30,31,31,30,31,30,31};//闰年
然后把月份作为下标在这两个数组里一查就行。
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
nLastDay = 31;
break;
case 4:
case 6:
case 9:
case 11:
nLastDay = 30;
break;
case 2:
if(nYear % 4 == 0)
if(nYear % 100 == 0)
if(nYear % 400 == 0)
nLastDay = 29;
else
nLastDay = 28;
else
nLastDay = 29;
else
nLastDay = 28;
}
{
int nRet;
switch(month)
{
case 4:
case 6:
case 9:
case 11:
nRet = 30;
break;
case 2:
if((year%4 == 0 && year%100 != 0) || year%400 == 0)
nRet = 29;
else
nRet = 28;
break;
default:
nRet = 31;
}
return nRet;
}
Days = !(Time.wYear % 4) && (Time.wYear % 100) || !(Time.wYear % 400) ? 29 : 28;
else if (Month < 8)
Days = 30 + (Month & 1);
else
Days = 31 - (Month & 1);到这里后Days即为所要的天数.