DateTime.getTimeZone()

Signature

String getTimeZone(DateTime date, boolean daylight_saving_name)

Domain

action, condition

Description

Gets the timezone id from DateTime object.

Parameters

NameTypeDescription
dateDateTimeA DateTime to get the timezone of.
daylight_saving_namebooleanIf true returns the daylight savings name.

Returns

TypeDescription
StringThe timezone id.

Cautions

none

Example


DateTime dateNow = DateTime.now();
String tz = DateTime.getTimeZone(dateNow, false);

Result is:
tz contains: "America/Los_Angeles time" if the host you are running on is set to PST