比如两个时间:
CString t1="2007/11/09 17:42:10.466"
CString t2="2007/11/09 17:42:11.287"
这样做的:
SYSTEMTIME tS,tE;
tS.wYear = nYear1;
tS.wMonth = nMonth1;
tS.wDay = nDate1;
tS.wHour = nHour1;
tS.wMinute = nMin1;
tS.wSecond = nSec1;
tS.wMilliseconds = nMilliSec1;
tE.wYear = nYear2;
tE.wMonth = nMonth2;
tE.wDay = nDate2;
tE.wHour = nHour2;
tE.wMinute = nMin2;
tE.wSecond = nSec2;
tE.wMilliseconds = nMilliSec2;
ULARGE_INTEGER fTime1;/*FILETIME*/
ULARGE_INTEGER fTime2;/*FILETIME*/
SystemTimeToFileTime(&tS,(FILETIME*)&fTime1);
SystemTimeToFileTime(&tE,(FILETIME*)&fTime2);
CString sTimeMilli;
sTimeMilli.Format("%d",(fTime2.QuadPart - fTime1.QuadPart)/10000);