祝愿前程似锦的古诗:用VB编写一个显示当前日期和时间的程序

来源:百度文库 编辑:高校问答 时间:2024/03/29 19:38:34

1.

Private Sub Form_Load()
Text1.Text = Now
End Sub

2.

Private Sub Timer1_Timer()
Text1.Text = Hour(Time) & ":"
Text2.Text = Minute(Time) & ":"
Text3.Text = Second(Time)
Text4.Text = Date
End Sub

==============
给你参考:
month(date)

day(date)

year(date)

second(time)

minute(time)

hour(time)

now

text1.text = Format(Date, "YYYY.MM.DD")
text2.text = Format(Time, "hh:mm:ss")

Private Sub Timer1_Timer()
Label1.Caption = Format(Now, "yyyy-mm-dd hh:mm:ss")
End Sub

Timer空间中的interval设置为1000