Creating a Timezone from String

I want to create a new timezone dynamically from a string.

Var Timezonestring As String
Timezonestring = "UTC"
Var TempTimeZone As New TimeZone(Timezonestring)

This does indeed create a new timezone, but the abbreviation is still GMT (which is my current time zone)

How can I do this right?

I gave up trying to solve that and just do this now:

New TimeZone(0)

is this like an array?

New TimeZone(0)
New TimeZone(1)
New TimeZone(2)
New TimeZone(3)

Is there a list of available timezones, so that I can write something like a translation table for that?

You can write GMT plus offset in a readable form too as


Var Timezonestring As String
Timezonestring = "GMT-03:00" // Brazil Standard Time
Var TempTimeZone As New TimeZone(Timezonestring)

The string is formated as GMT(+/-)hh:mm

No, it’s a constructor. Number of seconds from UTC

Look at the docs for TimeZone.Constructor. There’s a link to a Wikipedia page that shows what’s supposed to work (although UTC is on that list, but does not work)

Just for clarity, UTC technically isn’t a time zone, but a time standard that is the basis for civil time and time zones worldwide.

GMT on the other hand is a time zone.