vb中如何显示当前微秒

2024-12-29 03:36:48
推荐回答(3个)
回答1:

建立一个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

回答2:

VB 弄不了微妙,只能精确到毫秒。

回答3:

别费劲了,VB只能精确到毫秒级,根本看不到微秒。