风行者 发表于 2009-11-11 11:41:06

获取网络时间

系统的时间可以修改,有没有可以从网络上获取正确北京时间(包括日期)?

kodin 发表于 2009-11-12 04:04:54


#include <IE.au3>
$Form1 = GUICreate("", 468, 584, -1, -1)
$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, 12, 65, 440, 468)
GUISetState(@SW_HIDE)
_IENavigate ($oIE,"http://www.timedate.cn/worldclock/ti.asp")
$oP = _IETagNameGetCollection($oIE, 'table', 0)
MsgBox(0, "北京时间", $oP.innertext)

871224 发表于 2009-11-12 10:36:04

不错                      呵呵

顽固不化 发表于 2009-11-13 08:43:36

#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\autoit3\Aut2Exe\Icons\TM.ico
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <INet.au3>
Dim $Wkary=["日","一","二","三","四","五","六"]
$sData=_INetGetSource('http://s.time.org.cn/clock')
if @error Then
        MsgBox(4096,"错误","获取网络时间出现错误!")
        Exit
EndIf
$DATA = StringRegExp($sData, "=(.{1,4});", 3)
If StringLen($DATA) < 2 Then $DATA = "0" & $DATA
If StringLen($DATA) < 2 Then $DATA = "0" & $DATA
If StringLen($DATA) < 2 Then $DATA = "0" & $DATA
If StringLen($DATA) < 2 Then $DATA = "0" & $DATA
If StringLen($DATA) < 2 Then $DATA = "0" & $DATA
$Wk=Number(StringLeft($DATA,1))-1
$D_T = $DATA & "年" & $DATA & "月" & $DATA & "日" & @CRLF & "星期"&$Wkary[$Wk]& @CRLF & $DATA & ":" & $DATA & ":" & $DATA
MsgBox(4096, "北京时间", $D_T)

jneyxwry 发表于 2010-4-23 12:24:30

如果安装了sogou 或是360 浏览器,在运行时会跳出网页,请问这怎么解决呢?

menfan1 发表于 2010-4-24 08:36:18

呵呵。学习一下。。

dajun 发表于 2010-5-5 20:39:32

#include <IE.au3>
$oIE = _IECreate ("http://www.timedate.cn/worldclock/ti.asp",0,0)
$sText = _IEBodyReadText ($oIE)
MsgBox(0, "Body Text", $sText)
页: [1]
查看完整版本: 获取网络时间