≈※爖※≈ 发表于 2009-7-18 22:29:51

请问如何获取网页中的日期

http://www.timedate.cn/worldclock/ti.asp
像上面这个网页里面的日期,用AU3有什么方法可以获取到里面的日期吗?
下面是网上搜到用VB写的方法!不过我看不懂里面的webbrowser2是什么东东!

插入 webbrowser2

Private Sub WebBrowser2_DocumentComplete(ByVal pDisp As Object, URL As Variant)

If URL = "http://www.timedate.cn/worldclock/ti.asp" Then

    TEMP = WebBrowser2.Document.body.innertext
   
    temp1 = Left(TEMP, 4)
   
    temp2 = Mid(TEMP, InStr(TEMP, "年") + 1, InStr(TEMP, "月") - InStr(TEMP, "年") - 1)
    If Len(temp2) < 2 Then temp2 = "0" & temp2
   
    temp3 = Mid(TEMP, InStr(TEMP, "月") + 1, InStr(TEMP, "日") - InStr(TEMP, "月") - 1)
   
    If Len(temp3) < 2 Then temp3 = "0" & temp3
   
    'dels = "年月日一二三四五六日七星期 ::      "
    'For i = 1 To 20
    'TEMP = Replace(TEMP, Mid(dels, i, 1), "")
    'Next i
   
    'aaa = Left(TEMP, 8)
    aaa = temp1 & temp2 & temp3

大绯狼 发表于 2009-7-18 23:37:24

获得这个值以后。。。。很好办了吧。。。
#include <IE.au3>
$oIE = _IECreate ("http://www.timedate.cn/worldclock/ti.asp")
$sText = _IEBodyReadText ($oIE)
MsgBox(0, "Body Text", $sText)

lynfr8 发表于 2009-7-19 00:14:22

可以利用这个做个时间同步的小东西哦

afan 发表于 2009-7-19 00:26:12

有道理有道理
页: [1]
查看完整版本: 请问如何获取网页中的日期