国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

將WMI中的DateTime類型轉(zhuǎn)換成VBS時間的函數(shù)代碼

2020-07-26 11:51:04
字體:
供稿:網(wǎng)友
有兩種方法可以轉(zhuǎn)換,一種是自己寫個函數(shù)解析:
復制代碼 代碼如下:

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對象
復制代碼 代碼如下:

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

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 任丘市| 梓潼县| 建始县| 增城市| 乌拉特后旗| 兰州市| 英德市| 韶关市| 浦城县| 寿光市| 保靖县| 鄂托克旗| 兴业县| 朝阳县| 石首市| 洪洞县| 图木舒克市| 中西区| 永吉县| 江永县| 商南县| 英吉沙县| 福建省| 内乡县| 彭山县| 威海市| 合作市| 红安县| 嘉善县| 安泽县| 达州市| 榆社县| 北宁市| 甘谷县| 南岸区| 阿克苏市| 古田县| 白城市| 城市| 泾川县| 盐池县|