vb语言是如何获得系统时间的

如题所述

vb中获取系统当前的时间用函数 now() 就可以。另外还有相关的时间 date() time()
now()获取系统当前日期和时间,如:2015-12-12 22:23:34
time()获取系统的时间,如:22:23:34不显示当前日期
date()获得系统的日期,如:2015-12-12

Private Sub Command1_Click()
MsgBox Now()
MsgBox Time()
MsgBox Date
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-05-22
Now:系统日期及时间
Date:系统日期
Time:系统时间
如text1.text=Now ‘显示系统日期及时间
text1.text=Date ‘显示系统日期
text1.text=Time ‘显示系统时间本回答被网友采纳
第2个回答  2012-02-25
用NOW()获得现在时间 data()获得年月日 weekday()获得星期
第3个回答  2012-02-22
Option Explicit
Private WithEvents Timer1 As Timer

Private Sub Form_Load()
Set Timer1 = Controls.Add("vb.timer", "timer1")
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Cls
Print Now
End Sub

直接贴代码运行就可以看到了
相似回答