From Xojo Documentation

Class (inherits from Object)

New in 2019r2

Used to identify a time zone in relationship to a Date.

Abbreviation fa-lock-32.png SecondsFromGMT fa-lock-32.png

Constructor(gmtOffsetInSeconds As Integer)

Constructor(name As String)

Shared Methods


Use any valid timezone. A list of common time zones is available here.

Sample Code

Creates a DateTime for Berlin timezone that matches the local timezone's hours and minutes:

Var d As DateTime = DateTime.Now(New TimeZone("Europe/Berlin"))

Convert a date in the local time zone to the GMT time zone:

Var date1 As DateTime = New DateTime(2021, 2, 1, 13, 0, 0, 0, TimeZone.Current)
Var gmt As New TimeZone(0) // Get GMT time zone
Var gmtDate As New DateTime(date1.SecondsFrom1970, gmt)

See Also

DateTime class