Private Function GetTime() As Date Dim TimeStr As String Dim oXMLHTTP As Object Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP") oXMLHTTP.open "HEAD", "http://www.baidu.com", False '取百度的时间 oXMLHTTP.send TimeStr = oXMLHTTP.getResponseHeader("Date") GetTime = DateAdd("h", 8, CDate(Trim(Split(Split(TimeStr, ",")(1), "GMT")(0)))) End Function
获取网络时间做验证,直接读取百度时间对比截止日期就能做验证了。这代码很不错,可以收藏一下哦!
直接调用GetTime() 就能得到百度的当前时间。