dateTime conversion (WMI)

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi there,

working with WMI is pretty convenient. But right now, Im having some trouble converting a datetime to a prper format.
<font color="#ff0000" size="2 string </font><font size="2 s </font><font color="#006400" size="2 = </font><font size="2 queryObj</font><font color="#006400" size="2 [</font><font color="#ff00ff" size="2 "InstallDate"</font><font color="#006400" size="2 ].</font><b><font color="#191970" size="2 ToString</b></font><font color="#006400" size="2 ();
<font color="#000000 <u>Gives back:
</u></font><font color="#000000 20050811230811.000000+480
</font>
<font color="#ff0000 How do I get date out of this?</font>
</font>I alread tried:
<font color="#ff0000" size="2 string </font><font size="2 s </font><font color="#006400" size="2 = </font><font size="2 queryObj</font><font color="#006400" size="2 [</font><font color="#ff00ff" size="2 "InstallDate"</font><font color="#006400" size="2 ].</font><b><font color="#191970" size="2 ToString</b></font><font color="#006400" size="2 ();
</font><font size="2 DateTime dc </font><font color="#006400" size="2 = </font><font size="2 Convert</font><font color="#006400" size="2 .</font><b><font color="#191970" size="2 ToDateTime</b></font><font color="#006400" size="2 (</font><font size="2 s</font><font color="#006400" size="2 );

<font color="#000000 But that doesnt work, telling me, String was not recognized as a valid datetime...

Thanks for any help!

Finch.</font> </font>


View the full article
 
Back
Top