vb获得准确的网络时间
'准确的网络时间(http://www.time.ac.cn/stime.asp 准确的北京时间)
'先在 部件中加入网络控件 Microsoft Internet Transfer Control 6.0
'Time0 =年月日
'date0 =时间
Private Sub Form_Load()
On Error Resume Next '遇到错误,直接执行下一行。
Dim StrCoding As String
StrCoding = Inet1.OpenURL("http://www.time.ac.cn/stime.asp")
Dim Time0 As String, date0 As String
Time0 = Right(Split(StrCoding, "年")(0), 4) & "年" & Split(Split(StrCoding, "年")(1), "日")(0) & "日"
date0 = Left(Split(StrCoding, "var hrs = ")(1), 2) & ":" & Left(Split(StrCoding, "var min = ")(1), 2) & ":" & Left(Split(StrCoding, "var sec = ")(1), 2)
Label1.Caption = Time0 & " " & date0
End Sub
_____________________________________________________________________________ _
中磊UG二次开发教程 梅雷著 qq1821117007
学UG就上UG网 http://www.9sug.com/ |