找回密码
 加入
搜索
查看: 4749|回复: 2

[IE类操作] 【已解决】谁帮忙修改下这个网络获取时间的

[复制链接]
发表于 2015-1-19 14:26:40 | 显示全部楼层 |阅读模式
本帖最后由 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[5] & "/" & $ss[4] & "/" & $ss[3] & " " & $ss[6] & ":" & $ss[7] & ":" & $ss[8]
MsgBox("","时间为",$shijianxiaoyan1)

这个是从www.baidu.com/?获取时间的,以前很准的,但是2015年后时间变不准了,谁能帮忙把他改成从 www.baidu.com获取时间,谢谢了
发表于 2015-1-19 15:46:53 | 显示全部楼层
#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[5] & '/' & $ss[4] & '/' & $ss[3] & ' ' & $ss[6] & ':' & $ss[7] & ':' & $ss[8])
MsgBox('', '时间为', $shijianxiaoyan1)
发表于 2015-10-21 14:50:43 | 显示全部楼层
怎么这几个运行的时候老有这个错误啊。运行不起来呀。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
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-16 22:45 , Processed in 0.081623 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表