在VC中,定义变量 COleDateTime date;
date的值为20060501。
赋给字符串 strDate
CString strDate = date.Format("%Y%m%d");
CString strMonth = strDate.Left(6);
这样子,strMonth就是200605了。
问题:
怎么把strMonth变为上个月的值,就是200604?
date的值为20060501。
赋给字符串 strDate
CString strDate = date.Format("%Y%m%d");
CString strMonth = strDate.Left(6);
这样子,strMonth就是200605了。
问题:
怎么把strMonth变为上个月的值,就是200604?
CString strMonth = str(val(strDate.Left(6))-1);
减少时间可以用CTime减去CTimeSpan