建立一个FORM,添加一个time控件
输入如下代码
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 Sub Form_Load()
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
Dim t As SYSTEMTIME
GetLocalTime t
Cls
Print DateSerial(t.wYear, t.wMonth, t.wDay) & " " & TimeSerial(t.wHour, t.wMinute, t.wSecond) & "." & t.wMilliseconds
End Sub
VB 弄不了微妙,只能精确到毫秒。
别费劲了,VB只能精确到毫秒级,根本看不到微秒。