I am running an FTP program in VB 6.0. When I link to my IBM AS400 UNIX system the time displayed in the FTP program is as 7 hours less than the actual UNIX system time.
These are my Declared statements:
Private Const rDayZeroBias As Double = 109205# ' Abs(CDbl(#01-01-1601#))
'Private Const rMillisecondPerDay As Double = 10000000# * 60# * 60# * 24# / 10000# '= 86400000
Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As Any, lpLocalFileTime As Any) As Long
This is the function I am Calling.
Private 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
Can anyone tell me how to correct this problem? I have been all over the internet and have found nothing.
These are my Declared statements:
Private Const rDayZeroBias As Double = 109205# ' Abs(CDbl(#01-01-1601#))
'Private Const rMillisecondPerDay As Double = 10000000# * 60# * 60# * 24# / 10000# '= 86400000
Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As Any, lpLocalFileTime As Any) As Long
This is the function I am Calling.
Private 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
Can anyone tell me how to correct this problem? I have been all over the internet and have found nothing.