DateTime.TimeZone

The DateTime.TimeZone value type represents a time zone.

Time zones are identified using regional names from the IANA Time Zone Database, such as "America/Los_Angeles" or "Australia/Sydney". Abbreviated names like "PST" and "EDT" are not valid names.

The complete list of available time zone names is shown below.

function DateTime.TimeZone(String name) → DateTime.TimeZone

Creates a TimeZone for the time zone name.

var timezone = DateTime.TimeZone("Australia/Melbourne")
System.log("Time in Melbourne is:", DateTime.now(timezone))

If the name does not refer to a valid time zone, the UTC time zone will be used instead. You can check if the name was valid by testing the isValid property after creating it.

property String nameread only

The IANA time zone name.

property Bool isValidread only

True if a valid time zone name was used to create the TimeZone, and false if not.

function offset(DateTime time) → Int

Returns the the time zone's offset in seconds east of UTC at the specified time.

The offset may vary throughout the year due to daylight savings time or other regional factors.

function abbreviation(DateTime time) → String

Returns an abbreviated name for time zone, such as "AEST" or "ADST", at the given time.

The abbreviation may change during the year due to daylight savings time or other regional factors.