VB如何制作自动校对时间

VB如何制作自动校对时间,第1张

我要的是我的系统时间对回北京时间

你是什么意思??

我的代码的功能是 连接标准北京时间的网站 获取时间 然后更改你本机的系统时间为北京时间~和你的要求有什么不一样吗

Dim a, b, c, x, y

Private Sub Command1_Click()

Dim time As String

Dim day As String

Dim m As String

Dim n As String

WebBrowser1navigate ">

系统托盘里显示图标的话用NotifyIcon组件,建立一个ContextMenuStrip控件与之关联。关联的位置在NotifyIconContextMenuStrip。关机直接shell 命令列:rundll32exe userexe,exitwindows就可以,声音提示用MyCompurerAudioPlay ("路径"),提示消息用Msgbox函数……通过判断返回值在确定是否关机……手头没有VBNet……大概思路就是这样,不知道能不能对你有帮助……如果要代码的话,不忙的时候可以给你写

修改:包括年月日时分秒

'一个标签,一个定时器,一个命令按钮

Const cstDate As Date = "13:00:00"

Dim blnIsBeiJIng As Boolean

Private Sub Command1_Click()

'纽约的时区是西5区 (GMT-5),冬天比中国(GMT+8)慢13个小时,夏天慢12个小时,夏令时未处理

If Command1Caption = "改为纽约时间" Then

Command1Caption = "改为北京时间"

blnIsBeiJIng = False

Else

Command1Caption = "改为纽约时间"

blnIsBeiJIng = True

End If

End Sub

Private Sub Form_Load()

Timer1Interval = 500

blnIsBeiJIng = True

Command1Caption = "改为纽约时间"

End Sub

Private Sub Timer1_Timer()

Dim dte1 As Date

If blnIsBeiJIng = True Then

Label1Caption = Now

Else

dte1 = Now

dte1 = dte1 - cstDate

Label1Caption = dte1

End If

End Sub

原回答,不带日期

'一个标签,一个定时器,一个命令按钮

Dim dte1 As Date, blnIsBeiJIng As Boolean

Private Sub Command1_Click()

'纽约的时区是西5区 (GMT-5),冬天比中国(GMT+8)慢13个小时,夏天慢12个小时,夏令时未处理

If Command1Caption = "改为纽约时间" Then

Command1Caption = "改为北京时间"

blnIsBeiJIng = False

Else

Command1Caption = "改为纽约时间"

blnIsBeiJIng = True

End If

End Sub

Private Sub Form_Load()

Timer1Interval = 500

blnIsBeiJIng = True

Command1Caption = "改为纽约时间"

End Sub

Private Sub Timer1_Timer()

Dim str1 As String, i As Integer

If blnIsBeiJIng = True Then

Label1Caption = Time

Else

str1 = Time

i = Left(str1, InStr(1, str1, ":") - 1)

i = i + IIf(i < 13, 11, -13)

Label1Caption = CStr(i) & Mid$(str1, InStr(1, str1, ":"))

End If

End Sub

以上就是关于VB如何制作自动校对时间全部的内容,包括:VB如何制作自动校对时间、VB计算时间差、用vb.net编写程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/10062132.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-04
下一篇 2023-05-04

发表评论

登录后才能评论

评论列表(0条)

保存