有兩種方法可以轉(zhuǎn)換,一種是自己寫個函數(shù)解析:
復(fù)制代碼 代碼如下:
Function WMIDateStringToDate(DateTime)
WMIDateStringToDate = _
CDate(Mid(DateTime, 5, 2) _
"/" _
Mid(DateTime, 7, 2) _
"/" _
Left(DateTime, 4) _
" " _
Mid (DateTime, 9, 2) _
":" _
Mid(DateTime, 11, 2) _
":" _
Mid(DateTime, 13, 2))
End Function
另一種是使用SWbemDateTime對象
復(fù)制代碼 代碼如下:
Function WMIDateStringToDate(DateTime)
Set WbemDateTime = _
CreateObject("WbemScripting.SWbemDateTime")
WbemDateTime.Value = DateTime
WMIDateStringToDate = WbemDateTime.GetVarDate()
End Function
參考鏈接:It's About Time (Oh, and About Dates, Too)
原文:http://demon.tw/programming/wmi-datetime-vbs.html
您可能感興趣的文章:- VB中使用WMI獲取系統(tǒng)硬件和軟件有關(guān)信息
- VBS調(diào)用WMI遍歷搜索硬盤文件并計數(shù)的方法
- vbs通過WMI修改文件文件夾的NTFS權(quán)限
- WMI StdRegProv 通過wmi操作注冊表的vbscript實現(xiàn)代碼 (本地或遠(yuǎn)程)
- VBS通過WMI監(jiān)視注冊表變動的代碼
- VBS通過WMI獲取CPU使用率的代碼
- VBS調(diào)用WMI實現(xiàn)搜索硬盤mp3文件
- Rcmd.vbs [Remote Cmd with wmi]遠(yuǎn)程腳本
- VBS調(diào)用WMI快速關(guān)閉IE的腳本
- VBS腳本使用WMI操作注冊表的代碼
- vbs wmi獲取電腦硬件信息實例
- 初窺WMI_Vbs腳本編程簡明教程補充讀物
- 使用WMI得到計算機的信息