Re: String to FILETIME
G, you are right. The code I pasted is not what I'm using. There is a
subtle difference, but I was mostly trying to strip that off before doing
the parsing. Since the GMT value is there it could be added into the mix,
but I didn't need that granularity for what I was doing. I don't know if
ParseDateTime() would like the +- or Z stuff from UTC. I suspect not.
CTime Mycode::ConvertUTCDateTime(LPCTSTR szDateTime)
{
// Parse the start date from format 2008-04-03T16:03:52+08:00
CString cs = szDateTime;
int i = cs.Find(_T('T'));
if(i != -1) {
CString csDate = cs.Left(i);
CString csTime = cs.Mid(i+1);
i = csTime.ReverseFind(_T('+'));
if(i == -1) {
i = csTime.ReverseFind(_T('-'));
}
if(i != -1) {
// Use GMT?
csTime = csTime.Left(i);
}
cs.Format(_T("%s %s"),csDate,csTime);
COleDateTime oTime;
if(oTime.ParseDateTime(cs)) {
SYSTEMTIME sTime;
oTime.GetAsSystemTime(sTime);
return CTime(sTime);
}
}
return CTime::GetCurrentTime();
}