vb 如何获得比now更精确的时间?

来源:百度知道 编辑:UC知道 时间:2024/06/19 04:32:19
如题
是的要精确到微秒,帮助提供个例子,谢谢!

你要确定到MS???那么用API吧

Public Sub test()
Dim datNow As Date
Dim intMilliSecs As Integer

Call utlCOMTime.getLocalTimeWithMilliSecs(datNow, intMilliSecs)

Debug.Print datNow
Debug.Print intMilliSecs

End Sub

Public Sub getLocalTimeWithMilliSecs(ByRef datNow As Date, ByRef intMilliSecs As Integer)
#If Mac Then
Call getLocalTimeWithMilliSecs_forMac(datNow, intMilliSecs)
#Else
Call getLocalTimeWithMilliSecs_forWindows(datNow, intMilliSecs)
#End If
End Sub

Private Sub getLocalTimeWithMilliSecs_forWindows(ByRef datNow As Date, ByRef intMilliSecs As Integer)

Dim utySystemTime As SYSTEMTIME
Dim strDate As String

Call GetLocalTime(utySystemTime)

strDate = CStr(utySystemTime.wYear) & "/" _
& CStr(utySystemTime.wMonth) & "/" _
&