How get Win32_OperatingSystem.LastBootUpTime in datetime format

后端 未结 2 1020
醉酒成梦
醉酒成梦 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.

提交回复
热议问题