offset = $usertz * 3600; } /** * Formats a UNIX timestamp to a certain date format in the proper time * zone * * @param string Format of the date (same as PHP's date() function) * @param integer UNIX timestamp to format * @param bool Adjust the date to the user's language? * * @return string Formatted date */ public function format($format, $timestamp = TIMENOW, $adjust = true) { if ($adjust) { $timestamp += $this->offset; } return gmdate($format, $timestamp); } /** * Fetches an array of timezone names indexed by their offset * * @return array List of timezones */ public static function fetch_timezone_list() { $opt = array(); $opt['-12'] = _('(GMT - 12:00) Enitwetok, Kwajalien'); $opt['-11'] = _('(GMT - 11:00) Midway Island, Samoa'); $opt['-10'] = _('(GMT - 10:00) Hawaii'); $opt['-9'] = _('(GMT - 9:00) Alaska'); $opt['-8'] = _('(GMT - 8:00) Pacific Time (US & Canada)'); $opt['-7'] = _('(GMT - 7:00) Mountain Time (US & Canada)'); $opt['-6'] = _('(GMT - 6:00) Central Time (US & Canada)'); $opt['-5'] = _('(GMT - 5:00) Eastern Time (US & Canada)'); $opt['-4'] = _('(GMT - 4:00) Atlantic Time (Canada)'); $opt['-3.5'] = _('(GMT - 3:30) Newfoundland'); $opt['-3'] = _('(GMT - 3:00) Brazil, Buenos Aires, Georgetown'); $opt['-2'] = _('(GMT - 2:00) Mid-Atlantic, St. Helena'); $opt['-1'] = _('(GMT - 1:00) Azores, Cape Verde Islands'); $opt['0'] = _('(GMT) London, Dublin, Casablanca'); $opt['1'] = _('(GMT + 1:00) Berlin, Madrid, Paris'); $opt['2'] = _('(GMT + 2:00) Kaliningrad, South Africa, Warsaws'); $opt['3'] = _('(GMT + 3:00) Baghdad, Moscow, Nairobi'); $opt['3.5'] = _('(GMT + 3:30) Tehran'); $opt['4'] = _('(GMT + 4:00) Abu Dhabi, Tbilisi, Muscat'); $opt['4.5'] = _('(GMT + 4:30) Kabul'); $opt['5'] = _('(GMT + 5:00) Ekaterinburg, Islamabad, Tashkent'); $opt['5.5'] = _('(GMT + 5:30) Calcutta, Madras, New Delhi'); $opt['6'] = _('(GMT + 6:00) Almaty, Colomba, Dhakra'); $opt['7'] = _('(GMT + 7:00) Bangkok, Hanoi, Jakarta'); $opt['8'] = _('(GMT + 8:00) Beijing, Hong Kong, Singapore'); $opt['9'] = _('(GMT + 9:00) Seoul, Tokyo, Yakutsk'); $opt['9.5'] = _('(GMT + 9:30) Adelaide, Darwin'); $opt['10'] = _('(GMT + 10:00) Guam, Papua New Guinea, Sydney'); $opt['11'] = _('(GMT + 11:00) Magadan, New Caledonia, Solomon Islands'); $opt['12'] = _('(GMT + 12:00) Auckland, Wellington, Fiji'); return $opt; } } ?>