
正文
vb.net当前时间的简单介绍
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb net获取系统时间
Sub gettime()
nowtime = Format(DateTime.Now, "yyyy/MM/dd hh:mm:ss")
MsgBox nowtime
End Sub
其中DateTime.Now为当前系统的时间
Format是设置时间格式
效果如下
相关问答
Q1: vb.net保存.jpg文件 文件名为当前时间,怎么实现,各位谢谢了。。。。
now()可以返回当前时间,如果你要把它作文件名,那么需要先转换成string,可以使用
format函数
,比如format(now(),
Q2: 怎么在VB.net中实时显示时间
定时器中处理
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 10 '10毫秒刷新一次
Timer1.Start() '开启定时器
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = Now
End Sub






