DateTime.TimeZone

The DateTime.TimeZone value type represents a timezone.

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 timezone names is shown below.

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

Creates a TimeZone for the timezone 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 timezone, the UTC timezone 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 timezone name.

property Bool isValidread only

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

function offset(DateTime time) → Int

Returns the the timezone'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 timezone, 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.