|
Access没法精确到毫秒。貌似要引用API,测试代码如下:- Private Declare Function timeGetTime Lib "winmm.dll" () As Long '32位系统
- 'Private Declare PtrSafe Function timeGetTime Lib "winmm.dll" () As Long '64位系统
- Sub GetMillisecond()
- Dim t1 As Long, t2 As Long, t3 As Date, t4 As Date
- Dim i As Long
- t1 = timeGetTime() '获取当前毫秒数
- t3 = Now()
- Debug.Print "t1=" & t1 & ",当前时间为:" & t3
- 'Application.Wait Now + TimeValue("0:00:01") '等待一秒
- For i = 1 To 10
- Debug.Print i
- Next
- t2 = timeGetTime() '再次获取当前毫秒数
- t4 = Now()
- Debug.Print "t2=" & t2 & ",当前时间为:" & t4
- Debug.Print "t2-t1=" & (t2 - t1) '计算两次获取之间的差值
- End Sub
复制代码 测试结果可以看到t3和t4的时间都是一样的(15:42:10),但t2和t1是有些差异的。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|