Take the 2-minute tour ×

How can I convert a "YYYY/MM/DD" formatted date to a VARIANT type date and vice-versa in C++?


VARIANT VT_DATE Type passed by VBA code into an automation COM written in c++

share|improve this question
You need to specify where that VARIANT type comes from. Is it Win32-specific? –  unwind Jun 8 '10 at 8:55
add comment

1 Answer

Did you try via CComVariant ?

E.g. : (from string to date)

CComVariant myDate("YYYY/MM/DD date");
if (SUCCEEDED(myDate.ChangeType(VT_DATE)) && SUCCEEDED(myDate.Detach(&myVBDate)))
    // do something with myVBDate
share|improve this answer
add comment

Your Answer


