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?
Greg_O
(Greg O)
June 7, 2023, 11:14am
2
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?
Rick_A
(Rick A)
June 7, 2023, 11:37am
4
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
Greg_O
(Greg O)
June 7, 2023, 11:38am
5
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)
Greg_O
(Greg O)
June 7, 2023, 11:45am
6
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 .