1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Converting 8 byte hex value to datetime value

Discussion in 'C' started by Jude_Aj, Mar 17, 2009.

  1. Jude_Aj

    Jude_Aj New Member

    Joined:
    Mar 17, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    i am reading an .mdf file (sql server 2000 file) in raw format.
    i have a value a datetime value of "f913e300 939b0000"(big endian) which represents value "Jan 16 2009 1:46PM".I had used Coledatetime class to convert this hex value to date time.Its giving me the right date but the time is incorrect.Here is what i tried to do.

    Code: C++
    int date_part = "1st 4 bytes of 8 byte date time value";//0x00009b93
    int time_part = "next 4 bytes of 8 byte date time value"//0x00e313f9/1000

    COleDateTime startOnDate(1900, 1, 1, 0, 0, 0);

    startOnDate += COleDateTimeSpan(date_part, 0, 0, time_part);

    CString buffer = startOnDate.Format();



    I'm i going wrong somewhere.Is there any alternate way of doing this?
    Any help would be appreciated.
    Thanks
     

Share This Page