VB中如何显示系统时间

来源:百度知道 编辑:UC知道 时间:2024/09/22 09:36:43
VB中怎么在文本框中显示当前时间?

利用 Now()函数。并配合格式化函数format(),可以显示出你想要的格式的
日期或时间。

例子:
Text1.text = Format(Now(), "yyyy-MM-dd hh:mm:ss")
Text1.text = Format(Now(), "hh:mm:ss")
Text1.text = Format(Now(), "yyyy年MM月dd日 hh时mm分ss秒")

(Begin VB.Timer Timer1
Private Sub Form_Load()
Text1.Text = Now
End Sub

Private Sub Timer1_Timer()
Text1.Text = Now`每秒时间更新一次‘
End Sub

Text1.Text = Now