I'm not sure what you mean when you say "I have my calculations based on
CST", but I'm thinking you shouldn't do that. The problem is not in finding
the time zone information on the computer your code is running on, but in
knowing how that relates to your CST time. The problem comes about with
Daylight Savings Time and the fact that the foreign computer cannot know
whether your system is using DST and, if you are, when it started (that
appears to vary around the globe). Also, not everyone using DST uses a
one-hour offset, so deciding as to how to apply DST and by how much could
prove problematic. In any event, here is the code to find out what the
offset (bias) is and what the DST bias is....
'*************** Start Module Code***************
Public Declare Function GetTimeZoneInformation& Lib _
"kernel32" (lpTimeZoneInformation As _
TIME_ZONE_INFORMATION)
Public 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
Public 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
'*************** End Module Code ***************
'*************** Start of Code Where Needed ***************
Dim TZ As TIME_ZONE_INFORMATION
Dim TimeZoneBiasInMinutes As Long
Dim DayLightSavingTimeBiasInMinutes As Long
'.....
'.....
GetTimeZoneInformation TZ
TimeZoneBiasInMinutes = TZ.Bias
DayLightSavingTimeBiasInMinutes = TZ.DaylightBias
'*************** End of Code Where Needed ***************
Note that the TimeZoneBiasInMinutes is the number of minutes adjustment from
Greenwich Mean Time. Normally, this is specified in hours, so if you want it
that way, just divide by 60.