怎样在窗体上实时显示当前时间?
格式:??时??分??秒???毫秒一定要显示出毫秒,谢谢!!或者说用format()函数,怎样显示出当前时间的毫秒值?谢谢!!!...
格式:??时??分??秒???毫秒
一定要显示出毫秒,谢谢!!
或者说用format()函数,怎样显示出当前时间的毫秒值?
谢谢!!! 展开
一定要显示出毫秒,谢谢!!
或者说用format()函数,怎样显示出当前时间的毫秒值?
谢谢!!! 展开
1个回答
展开全部
加个timer控件,设interval为1
Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Function CurrentTime() As String
Dim SYSTEMTIME As SYSTEMTIME
GetLocalTime SYSTEMTIME
CurrentTime = SYSTEMTIME.wYear & "/" & SYSTEMTIME.wMonth & "/" & SYSTEMTIME.wDay & " " & SYSTEMTIME.wHour & ":" & SYSTEMTIME.wMinute & ":" & SYSTEMTIME.wSecond & "." & SYSTEMTIME.wMilliseconds
End Function
Private Sub Timer1_Timer()
Me.Caption = CurrentTime
End Sub
Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Function CurrentTime() As String
Dim SYSTEMTIME As SYSTEMTIME
GetLocalTime SYSTEMTIME
CurrentTime = SYSTEMTIME.wYear & "/" & SYSTEMTIME.wMonth & "/" & SYSTEMTIME.wDay & " " & SYSTEMTIME.wHour & ":" & SYSTEMTIME.wMinute & ":" & SYSTEMTIME.wSecond & "." & SYSTEMTIME.wMilliseconds
End Function
Private Sub Timer1_Timer()
Me.Caption = CurrentTime
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询