AW: GMT-Umwandlung
25.01.2017 23:42:17
Planlos
Hallo
versuch
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 Type
Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName As String * 64
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName As String * 64
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
Private Declare Function SystemTimeToTzSpecificLocalTime Lib "KERNEL32.DLL" _
( _
ByVal lpTIME_ZONE_INFORMATION As Long, _
ByRef lpUniversalTime As SYSTEMTIME, _
ByRef lpLocalTime As SYSTEMTIME _
) As Long
Private Declare Function GetTimeZoneInformation Lib "KERNEL32.DLL" _
( _
ByVal lpTIME_ZONE_INFORMATION As Long _
) As Long
Private Declare Function VariantTimeToSystemTime Lib "OLEAUT32.DLL" _
( _
ByVal vbtime As Double, _
lpSystemTime As SYSTEMTIME _
) As Long
Private Declare Function SystemTimeToVariantTime Lib "OLEAUT32.DLL" _
( _
lpSystemTime As SYSTEMTIME, _
vbtime As Double _
) As Long
Function UTCToLocalTime(ByVal Datetime As Double) As Date
Dim st As SYSTEMTIME
Dim tzi As TIME_ZONE_INFORMATION
Const TIME_ZONE_ID_INVALID = &HFFFFFFFF
VariantTimeToSystemTime Datetime, st
If GetTimeZoneInformation(VarPtr(tzi)) TIME_ZONE_ID_INVALID Then
SystemTimeToTzSpecificLocalTime VarPtr(tzi), st, st
SystemTimeToVariantTime st, Datetime
UTCToLocalTime = Datetime
End If
End Function