北京时间

收集整理一些天气与时间日期相关的信息

vba取北京时间,vba 获取时间戳

当前日期:2024-10-20 03:45:00

VB中如何提取标准北京时间显示到label中

'使用本代码需要Ctrl+T里面勾选Microsoft Internet Control 6.0,并在窗体上画一个,默认名称是WebBrowser1

'然后添加一个文本框Label1和一个按钮Timer1

Private Sub Form_Load()

Label1.Caption=""

Label1.AutoSize= True'自动调整大小

WebBrowser1.Width= 0'为了不让其显示出来,设置宽度为0

WebBrowser1.Height= 0''为了不让其显示出来,设置高度为0

WebBrowser1.Navigate""

End Sub

Private Sub Timer1_Timer()

ss= WebBrowser1.Document.body.innerText'得到所有文字

aa="您的本地电脑时间"'找出要分离的文字前面有标志性的文字

bb= InStr(1, ss, aa)'确定位置

cc= Mid(ss, bb+ Len(aa)+ 1, 14)'取出要的东西

Label1.Caption="国家授时中心标准时间:"& Trim(cc)'显示出来

End Sub

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

Timer1.Interval= 100'每秒更新一次

Timer1.Enabled= True'启动定时器

End Sub

相关内容