I'm trying to write a function which converts a time between timezones.
For example:
convertedTime = TimezoneConvert("15/03/2020 12:00", "Central Standard Time", "Turkey Standard Time")
Now... the way it works so far is that it loops through each time zone key in the registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones) and reads the "Std" and "Dlt" string values. Once it finds a matching string to the specified time zone parameter, it populates a TIME_ZONE_INFORMATION object with the relevant data.
Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(0 To 31) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(0 To 31) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
Afterwards it uses the information in this object to do the conversion.
The function currently works for daylight savings, but the user has to know that it's in effect and call the function like so:
convertedTime = TimezoneConvert("15/03/2020 12:00", "Central Summer Time", "Turkey Standard Time")
I was just wondering if there is anything in the registry or on windows itself that identifies if a time zone key such as "Central Standard Time" currently has daylight saving in effect? That way, I can modify the code in a way so that if "Central Standard Time" was entered as a parameter, it could return the correct time with daylight savings applied.
If not, does anyone have any suggestions as to how this might be achieved?
I've had a look at the windows api method GetTimeZoneInformation but it seems to only return a timezone object for the local time on the machine.
I know you can do this with an outlook object using the .ConvertTime method, however this application may be installed on machines where outlook is not present.