Below you'll find the source for the Visual Basic 6 function UTCdifference.
Attribute VB_Name = "modUTCdifference"
' This function is downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
'
' You may freely distribute this file but please leave all comments, including this one, in it.
'
' @Author Stefan Thoolen <mail@stefanthoolen.nl>
Option Explicit
Private Declare Function GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
Private Const TIME_ZONE_ID_DAYLIGHT = 2&
Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(32) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(32) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
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
''
' Gives the difference between UTC and local time in seconds
' The GetTimeZoneInformation API can give other answers since it doesn't work with daylight saving time proparly
' @return Double Amount of seconds of difference between UTC and local time
' @author Stefan Thoolen <mail@stefanthoolen.nl>
Public Function UTCdifference() As Double
Dim tzi As TIME_ZONE_INFORMATION
If GetTimeZoneInformation(tzi) = TIME_ZONE_ID_DAYLIGHT Then UTCdifference = UTCdifference + 3600
UTCdifference = UTCdifference - (tzi.Bias * 60)
End Function