CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2000
    Posts
    6

    serialize COleDateTime

    i would like to know if i could serialize a COleDateTime value and retrieve it later.
    Thanks



  2. #2
    Join Date
    Jun 2000
    Posts
    41

    Re: serialize COleDateTime

    Hi,please try like this:

    COleDateTime date(2000,9,21,16,0,0);
    COleVariant vaTimeDate=date;
    COleVariant vaTemp;
    vaTemp.ChangeType(VT_BSTR,&vaTimeDate);
    CString str=vaTemp.bstrVal;



    Hope it helps,
    Jack


  3. #3
    Join Date
    Sep 2000
    Posts
    6

    Re: serialize COleDateTime

    can i serialize it without changing to the cstring format?
    e.g

    COleDateTime time = COleDateTime::GetCurrentTime();
    CArchive ar(&somefile, CArchive::modeCreate + CArchive::modeWrite);
    ar << time;




    I tried using this and then retrieving it later but the value that i put in was different when i retrieve it.


  4. #4
    Join Date
    Jan 2017
    Posts
    1

    Re: serialize COleDateTime

    Try serializing the underlying DATE member (m_dt) inside of COleDateTime.

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: serialize COleDateTime

    Good reply to a 17-years old question!
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured