How to put Date into VARIANT data type?

Discussion in 'MFC' started by LeanA, Sep 11, 2010.

  1. LeanA

    LeanA New Member

    Joined:
    Sep 11, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,



    I want to insert a Date type into a VARIANT that will be used by a certain function that needs a Date, but requires a VARIANT* data type.



    The function looks something like this:



    _variant_t function(_bstr_t FriendlyName, _bstr_t SubjectName, _bstr_t SMSID, VARIANT *StartTime, VARIANT *EndTime)



    I can't do anything about the data type because it is a pre-defined function.



    I tried doing this, but I get an error when accessing the function:



    VARIANT varDate;

    VariantInit(&varDate);



    COleDateTime mytime(1996,1,1,0,0,0);

    varDate = _variant_t(mytime);



    Also when accessing the function, I do it like this:



    ->function(bstrName, bstrName2, bstrID, &varDate, &varDate);



    I hope somebody can help me.



    Thank you!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice