Re: String to FILETIME
Here is a routine I used to convert a date I had:
CTime MyApp::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('-'));
else {
// 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();
}
It workerd for me and I think the ParseDateTime() functions accepts a lot of
different date/time formats so it's pretty handy.
Tom
"Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> wrote in message
news:uAnOsaKgJHA.3708@TK2MSFTNGP04.phx.gbl...
"Tom Serface" <tom@nospam.camaswood.com> ha scritto nel messaggio
news:0514A9E3-50C6-4ABE-B317-F8629B5DE6C3@microsoft.com...
Take a look at:
http://msdn.microsoft.com/en-us/library/38wh24td(VS.80).aspx
It has some cool parsing functionality.
I've not used it, but does it support time zone specification?
Thanks,
Giovanni