/** * Answer the Time Zone that corresponds to our offset. * * @return object TimeZone * @access public * @since 5/10/05 */ function timeZone() { // Search through the array of timezones for one that matches. Otherwise, // build our own. The name and abbreviation are just a guess, as multiple // Time Zones have the same offset. $zoneArray = TimeZone::timeZones(); foreach (array_keys($zoneArray) as $key) { if ($this->offset->isEqualTo($zoneArray[$key]->offset())) { return $zoneArray[$key]; } } $obj = TimeZone::offsetNameAbbreviation($this->offset, $tzAbbreviation, $tzAbbreviation); return $obj; }
/** * Return an Array of TimeZones * * @return array * @access public * @since 5/3/05 * @static */ static function timeZones() { $array = array(TimeZone::offsetNameAbbreviation(Duration::withHours(0), 'Universal Time', 'UTC'), TimeZone::offsetNameAbbreviation(Duration::withHours(0), 'Greenwich Mean Time', 'GMT'), TimeZone::offsetNameAbbreviation(Duration::withHours(0), 'British Summer Time', 'BST'), TimeZone::offsetNameAbbreviation(Duration::withHours(-5), 'Eastern Standard Time', 'EST'), TimeZone::offsetNameAbbreviation(Duration::withHours(-4), 'Eastern Daylight Time', 'EDT'), TimeZone::offsetNameAbbreviation(Duration::withHours(-6), 'Central Standard Time', 'CST'), TimeZone::offsetNameAbbreviation(Duration::withHours(-5), 'Central Daylight Time', 'CDT'), TimeZone::offsetNameAbbreviation(Duration::withHours(-7), 'Mountain Standard Time', 'MST'), TimeZone::offsetNameAbbreviation(Duration::withHours(-6), 'Mountain Daylight Time', 'MDT'), TimeZone::offsetNameAbbreviation(Duration::withHours(-8), 'Pacific Standard Time', 'PST'), TimeZone::offsetNameAbbreviation(Duration::withHours(-7), 'Pacific Daylight Time', 'PDT')); return $array; }