如何获得当前时间的毫秒,谢谢

解决方案 »

  1.   

    呵呵,看看这些够用吗?说明:以下代码出自 枕善居(http://www.mndsoft.com/blog/)http://www.mndsoft.com/blog/blogview.asp?logID=36http://www.mndsoft.com/blog/blogview.asp?logID=161
      

  2.   

    我的问题时间获的当前的时间用now 然后精确到毫秒,谢谢
      

  3.   

    比如现在的now 为2005-04-22 12:12:11加个毫秒谢谢
      

  4.   

    这个函数返回的小数部分应该可以利用
    Timer 函数
          返回一个 Single,代表从午夜开始到现在经过的秒数。语法Timer说明Microsoft Windows中,Timer函数返回一秒的小数部分
      

  5.   

    Private Declare Function timeGetTime Lib "winmm.dll" () As Long
    Private Declare Function timeBeginPeriod Lib "winmm.dll" (ByVal uPeriod As Long) As Long
    Private Declare Function timeEndPeriod Lib "winmm.dll" (ByVal uPeriod As Long) As Long
      

  6.   

    用timer返回的小数部分就是现在的毫秒是吗,我这样写Dim c
       Dim Now_time() As String
       Dim Time_int As Integer
       Now_time = Split(Timer, ".")
       Time_int = UBound(Now_time)
       If Time_int = 1 Then
          c = Now & ":" & Now_time(1)
          MsgBox c
       Else
          c = Now
          MsgBox c
       End If
    这样得到的时间准吗?呵呵
      

  7.   

    Private Declare Sub GetSystemTime 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 TypePrivate Sub Form_Load()
        Me.Timer1.Enabled = True
        Me.Timer1.Interval = 1
    End SubPrivate Sub Timer1_Timer()
        Dim t As SYSTEMTIME, strt As String
        GetSystemTime t
        With t
            strt = (t.wHour + 8) Mod 24 & ":" & t.wMinute & ":" _
            & t.wSecond & "." & t.wMilliseconds
        End With
        Me.Caption = strt
    End Sub
      

  8.   

    timer是个时间累计器,是累计系统启动后时间的,属相对时间,并非绝对时间,它与当前系统时间没有直接关系。也就是说,你得到的毫秒数与当前系统时间中的毫秒数并不对应。