CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: datetime

  1. #1
    Join Date
    Jun 2010
    Posts
    115

    Question datetime

    I am looking into some WMI class, there are properties of type "datetime"

    class win32_something
    {
    //...
    datetime dt;
    //..
    };

    What type is that 'datetime' equivalent to in C library ?

    Thank you

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

    Re: datetime

    Well, I never used WMI but according to its documentation (http://msdn.microsoft.com/en-us/libr...37(VS.85).aspx) the datetime is formatted as:
    yyyymmddHHMMSS.mmmmmmsUUU
    I guess there is no any "equivalent" in C library but you could format such a value using sprintf or some similar function.
    How are you going to use this "'datetime' equivalent to in C library"?
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2010
    Posts
    115

    Re: datetime

    Hi, thanks for your reply
    Here is my code I try to read Win32_OperatingSystem's install data

    pClassObject->Get(L"InstallDate",0, &vtProp, CIM_EMPTY, 0);
    BSTR str=vtProp.bstrVal;

    ISWbemDatetime*o;
    //Create o's instance
    o->putval(str);
    // do somethingelse


    While debygging I sse the value of str is something like
    {aaaa-aaaa-zzz-eeee-eeeee}
    What happens ?
    I expect a time format string from Get method as you mentioned though.

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

    Re: datetime

    I have no idea where you have got such a value from (and how!) - it looks almost like a GUID value except the lenthes of fields you supplied are not correct...
    Anyway you could also look at this MSDN site.
    Victor Nijegorodov

  5. #5
    Join Date
    Jun 2010
    Posts
    115

    Re: datetime

    The InstallDate property in win32_operatingsystem is of type datetime, I am thinking the Get method from classobject pointer should result a string of double type indicating the date and time of the installation. Yes, it results in an odd GUID string.

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