How get Win32_OperatingSystem.LastBootUpTime in datetime format

后端 未结 2 999
醉酒成梦
醉酒成梦 2021-01-24 12:22

I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI).

HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, 
        &pclsObj, &         


        
相关标签:
2条回答
  • 2021-01-24 12:30

    You'll have to do some parsing to convert it. The format is yyyyMMddhhmmss.ffffff+zzz (zzz is UTC offset in minutes). The SWbemDateTime.GetVarDate() method can do it for you.

    0 讨论(0)
  • 2021-01-24 12:46

    You can safely ignore anything after the decimal point as in the format yyyymmddhhmmss..

    0 讨论(0)
提交回复
热议问题