E6 A1 A9 3E 12 3F E3 40 对应时间为 2007-11-30 13:41:00

解决方案 »

  1.   

    Option Explicit
        Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
        Dim sinStr As String
        Dim sinSj As Double
        Dim bytes(7) As Byte
        Dim i As Integer
        
    Private Sub Command1_Click()
        sinStr = "E6 A1 A9 3E 12 3F E3 40"
        Text1 = sinStr
        For i = 1 To Len(Text1) Step 3
            bytes((i - 1) / 3) = Val("&H" & Mid(sinStr, i, 2))
        Next
        CopyMemory ByVal VarPtr(sinSj), ByVal VarPtr(bytes(0)), 8
        Dim strDate As Date
        strDate = CDate(sinSj)
        Text2 = strDate
        Print strDate
    End Sub
      

  2.   

    Option Explicit
        Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
        Dim hexStr As String
        Dim bytes(7) As Byte
        Dim i As Integer
        Dim strDate As Date
         
    Private Sub Command1_Click()
        hexStr = "E6 A1 A9 3E 12 3F E3 40"
        Text1 = hexStr
        For i = 1 To Len(Text1) Step 3
            bytes((i - 1) / 3) = Val("&H" & Mid(hexStr, i, 2))
        Next
        CopyMemory ByVal VarPtr(strDate), ByVal VarPtr(bytes(0)), 8
        Text2 = strDate
    End Sub