我想以毫秒为单位
当前使用Timer()方法,但它仅提供第二次访问
任何想法?

请确保我不想将毫秒转换为毫秒

最佳答案

实际上,计时器功能可为您提供秒(以毫秒为单位)。返回值的整数部分是自午夜以来的秒数,小数部分可以转换为毫秒-只需将其乘以1000。

t = Timer

' Int() behaves exactly like Floor() function, i.e. it returns the biggest integer lower than function's argument
temp = Int(t)

Milliseconds = Int((t-temp) * 1000)

Seconds = temp mod 60
temp    = Int(temp/60)
Minutes = temp mod 60
Hours   = Int(temp/60)

WScript.Echo Hours, Minutes, Seconds, Milliseconds

' Let's format it
strTime =           String(2 - Len(Hours), "0") & Hours & ":"
strTime = strTime & String(2 - Len(Minutes), "0") & Minutes & ":"
strTime = strTime & String(2 - Len(Seconds), "0") & Seconds & "."
strTime = strTime & String(4 - Len(Milliseconds), "0") & Milliseconds

WScript.Echo strTime

07-26 08:17