如题,调用了一个API,返回一个 Currency 类型的值“12951969060000”,把他转换为时间应该是 “‎2011‎-0‎6‎-0‎8‎ 0‎1:11:50”请问如何转换?

解决方案 »

  1.   

    这个Currency 类型的值“12951969060000”是如何得来的~~~
      

  2.   

    Sat Jun 7 09:11:00 UTC+0800 2380
    2380年 06月 7日 09:11:00 周六
    转换了下,和LZ说的差别很大。
    就不献丑了。
      

  3.   

    Currency 类型与时间之间有什么规律吗?
      

  4.   


    使用 ,获取ftp上文件的修改时间
    FtpFindFirstFile 函数说明:http://msdn.microsoft.com/en-us/library/aa384146(v=VS.85).aspxFtpFindFirstFile 需要传入一个 WIN32_FIND_DATA, WIN32_FIND_DATA 这里包含文件修改时间
    http://msdn.microsoft.com/en-us/library/aa365740
    现在调用 FtpFindFirstFile 后,从WIN32_FIND_DATA.ftLastWriteTime可以返回修改时间。因为微软的列子是个WIN32_FIND_DATA.ftLastWriteTime 是个 FILETIME 类型,我找了一下资料在vb中可以用 Currency 代替,所以就取出了 12951969060000 这么一个值
      

  5.   

    API函数FileTimeToSystemTime可以将FILETIME转换为系统时间结构SYSTEMTIME
      

  6.   

    找到一个函数
    Function Win32ToVbTime(ft As Currency) As Date
        Dim ftl As Currency
        ' Call API to convert from UTC time to local time
        If FileTimeToLocalFileTime(ft, ftl) Then
            ' Local time is nanoseconds since 01-01-1601
            ' In Currency that comes out as milliseconds
            ' Divide by milliseconds per day to get days since 1601
            ' Subtract days from 1601 to 1899 to get VB Date equivalent
            Win32ToVbTime = CDate((ftl / rMillisecondPerDay) - rDayZeroBias)
        Else
            MsgBox Err.LastDllError
        End If
    End Function
      

  7.   


    Const rDayZeroBias As Double = 109205#   ' Abs(CDbl(#01-01-1601#))
    Const rMillisecondPerDay As Double = 10000000# * 60# * 60# * 24# / 10000#
    忘了俩句