"yxq" <ga***@163.net> skrev i en meddelelse
news:uG**************@TK2MSFTNGP09.phx.gbl...
Thank you very much!
But my VB.Net is version 2002, the ManagementDateTimeConverter will be
supported!
How to convert the CStr(oMgmtObj("InstallDate"))? thank you
Oops, I didn't know it wasn't supported in 1.0. The format is WMI specific,
and does not lend itself to direct parsing by .NET. (Which is probably why
MS introduced the converter class.) See the following link for at
description of the format:
http://msdn.microsoft.com/library/en...ime_format.asp
If all you want is the date, you can extract the date part like this:
dtm = DateTime.ParseExact(s.Substring(0, 8), "yyyyMMdd",
Globalization.CultureInfo.InvariantCulture)
(Assuming 's' is a String holding the WMI date from the management object.)
Getting the time of day right requires a bit more arithmetic, as the UTC
offset is specified in minutes.
/Jens
--
Jens Christian Mikkelsen
http://www.jcmikkelsen.dk