double GetValue(DATE A,DATE,B)
{
ColeDateTime M1(A);
ColeDateTime M1(B);
ColeDateTimeSpan t;
t=M2-M1;
return t.Getseconds();
}
怎么返回的值不对,太小了(只有0.00n)
{
ColeDateTime M1(A);
ColeDateTime M1(B);
ColeDateTimeSpan t;
t=M2-M1;
return t.Getseconds();
}
怎么返回的值不对,太小了(只有0.00n)
double GetValue(DATE A, DATE B)
{
COleDateTime M1(A);
COleDateTime M2(B);
COleDateTimSpan t;
t = M2 - M1;
return t.GetSeconds();
}在Visual C++ .NET中做如下的测试:
COleDateTime oletime1(2003, 11, 22, 8, 45, 00);
COleDateTime oletime2(2003, 11, 22, 8, 45, 30);
COleDateTimeSpan olets = oletime2 - oletime1; pDC->TextOut(0, 20, oletime1.Format("%H:%M:%S %A, %B %d, %Y"));
pDC->TextOut(0, 40, oletime2.Format("%H:%M:%S %A, %B %d, %Y"));
str.Format("%d", olets.GetSeconds());
pDC->TextOut(0, 80, str);
// 然后调用阁下所给的函数
str.Format("%f", GetValue(oletime1, oletime2));
pDC->TextOut(0, 240, str);
结果如下:
08:45:00 Saturday, November 22, 2003
08:45:30 Saturday, November 22, 2003
30
30.000000不知道阁下用来测试的数据是什么?这个办法对不对?
刚才的str为CString类型
成员函数舍入错误下列成员函数的早期版本中存在的一些舍入错误已修复:GetDays、GetHours、GetMinutes、GetSeconds、GetTotalDays、GetTotalHours、GetTotalMinutes、GetTotalSeconds。