Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Convert  WMI  Date-Time  Values  

 Content of Convert WMI Date-Time Values.vbs
MD5 Hash: 6A234351DE59231F69B1E0A7BC0B3606
' Description: Demonstrates a method for converting the Universal Time Coordinate (UTC) values used by WMI to standard date-time values. The script retrieves the date that the operating system was installed, and passes that UTC value to a function named WMIDateStringToDate. This function converts the UTC value (such as 20011029113047.000000-480) to a standard date-time value (such as 10/29/200111:30:47 AM).


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each strOS in objOS
dtmInstallDate = strOS.InstallDate
strReturn = WMIDateStringToDate(dtmInstallDate)
Wscript.Echo strReturn
Next

Function WMIDateStringToDate(dtmInstallDate)
WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & _
Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) _
& " " & Mid (dtmInstallDate, 9, 2) & ":" & _
Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, _
13, 2))
End Function

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a