【已解决】谁帮忙修改下这个网络获取时间的
本帖最后由 3370225 于 2015-1-19 19:51 编辑#include <Date.au3>
$http = ObjCreate("microsoft.xmlhttp")
$http.Open("Get", "http://www.baidu.com/?" & _Now(), False)
$http.Send("")
$baidutime = $http.GetResponseHeader("Date")
If $baidutime = "" Then
MsgBox("", "错误", "获取异常,请检测网络是否连通")
Exit
EndIf
$ss = StringSplit("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", ",")
For $ii = 1 To 12
$baidutime = StringReplace($baidutime, $ss[$ii], $ii)
Next
$ss = StringSplit($baidutime, ", :")
$shijianxiaoyan1 = $ss & "/" & $ss & "/" & $ss & " " & $ss & ":" & $ss & ":" & $ss
MsgBox("","时间为",$shijianxiaoyan1)
这个是从www.baidu.com/?获取时间的,以前很准的,但是2015年后时间变不准了,谁能帮忙把他改成从 www.baidu.com获取时间,谢谢了 #include <Date.au3>
$http = ObjCreate('microsoft.xmlhttp')
$http.Open('Get', 'http://www.baidu.com', False)
$http.Send('')
$baidutime = $http.GetResponseHeader('Date')
If $baidutime = '' Then Exit MsgBox('', '错误', '获取异常,请检测网络是否连通')
$ss = StringSplit('Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec', ',')
For $ii = 1 To 12
$baidutime = StringReplace($baidutime, $ss[$ii], $ii)
Next
$ss = StringSplit($baidutime, ', :')
$shijianxiaoyan1 = _DateAdd('h', 8, $ss & '/' & $ss & '/' & $ss & ' ' & $ss & ':' & $ss & ':' & $ss)
MsgBox('', '时间为', $shijianxiaoyan1) 怎么这几个运行的时候老有这个错误啊。运行不起来呀。The requested action with this object has failed.:请问一下,这是怎么回事呀?
+>14:45:52 AU3Check ended.rc:0
>Running:(3.3.14.0):C:\Program Files\AutoIt3\autoit3.exe "D:\autoit3_script_lenovo\Time Zone\GoodTime1.au3"
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"D:\autoit3_script_lenovo\Time Zone\GoodTime1.au3" (4) : ==> The requested action with this object has failed.:
$http.Open('Get', 'www.beijing-time.org', False)
$http^ ERROR
->14:45:53 AutoIt3.exe ended.rc:1
页:
[1]