新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
两种方式自己选用
目前创新互联公司已为上1000家的企业提供了网站建设、域名、网络空间、绵阳服务器托管、企业网站设计、宣恩网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = DateTime.Today.Year()
s = s DateTime.Today.Month()
s = s DateTime.Today.Day()
s = s DateTime.Now.Hour()
s = s DateTime.Now.Minute()
s = s DateTime.Now.Second()
MsgBox(s, vbDefaultButton1, Now())
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As String
s = Format(Now(), "yyyymmddhhmmss")
MsgBox(s, vbYes, Now())
End Sub
Sub gettime()
nowtime = Format(DateTime.Now, "yyyy/MM/dd hh:mm:ss")
MsgBox nowtime
End Sub
其中DateTime.Now为当前系统的时间
Format是设置时间格式
效果如下
用大写的H可以显示24小时制:
(Format(DateTime.Now, "yyyyMMddHHmmss")).ToString