]>
src.bluestatic.org Git - isso.git/blob - Date.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Date formatting system (Date.php)
29 * Defined constant time
31 define('TIMENOW', time());
34 * Date Formatting System
36 * This framework wraps date and time functions into one neat little
37 * package that takes care of modifying timestamps to meet the right
41 * @copyright Copyright ©2002 - [#]year[#], Blue Static
49 * Offset in seconds; this is set using fetch_offset()
54 // ###################################################################
56 * Sets the user time zone and then calculates the total offset
58 * @param float User time zone
60 public function setUserTimeZone($usertz)
62 $this->offset
= $usertz * 3600;
65 // ###################################################################
67 * Formats a UNIX timestamp to a certain date format in the proper time
70 * @param string Format of the date (same as PHP's date() function)
71 * @param integer UNIX timestamp to format
72 * @param bool Adjust the date to the user's language?
74 * @return string Formatted date
76 public function format($format, $timestamp = TIMENOW
, $adjust = true)
80 $timestamp +
= $this->offset
;
82 return gmdate($format, $timestamp);
85 // ###################################################################
87 * Fetches an array of timezone names indexed by their offset
89 * @return array List of timezones
91 public static function FetchTimeZoneList()
95 $opt['-12'] = _('(GMT - 12:00) Enitwetok, Kwajalien');
96 $opt['-11'] = _('(GMT - 11:00) Midway Island, Samoa');
97 $opt['-10'] = _('(GMT - 10:00) Hawaii');
98 $opt['-9'] = _('(GMT - 9:00) Alaska');
99 $opt['-8'] = _('(GMT - 8:00) Pacific Time (US & Canada)');
100 $opt['-7'] = _('(GMT - 7:00) Mountain Time (US & Canada)');
101 $opt['-6'] = _('(GMT - 6:00) Central Time (US & Canada)');
102 $opt['-5'] = _('(GMT - 5:00) Eastern Time (US & Canada)');
103 $opt['-4'] = _('(GMT - 4:00) Atlantic Time (Canada)');
104 $opt['-3.5'] = _('(GMT - 3:30) Newfoundland');
105 $opt['-3'] = _('(GMT - 3:00) Brazil, Buenos Aires, Georgetown');
106 $opt['-2'] = _('(GMT - 2:00) Mid-Atlantic, St. Helena');
107 $opt['-1'] = _('(GMT - 1:00) Azores, Cape Verde Islands');
108 $opt['0'] = _('(GMT) London, Dublin, Casablanca');
109 $opt['1'] = _('(GMT + 1:00) Berlin, Madrid, Paris');
110 $opt['2'] = _('(GMT + 2:00) Kaliningrad, South Africa, Warsaws');
111 $opt['3'] = _('(GMT + 3:00) Baghdad, Moscow, Nairobi');
112 $opt['3.5'] = _('(GMT + 3:30) Tehran');
113 $opt['4'] = _('(GMT + 4:00) Abu Dhabi, Tbilisi, Muscat');
114 $opt['4.5'] = _('(GMT + 4:30) Kabul');
115 $opt['5'] = _('(GMT + 5:00) Ekaterinburg, Islamabad, Tashkent');
116 $opt['5.5'] = _('(GMT + 5:30) Calcutta, Madras, New Delhi');
117 $opt['6'] = _('(GMT + 6:00) Almaty, Colomba, Dhakra');
118 $opt['7'] = _('(GMT + 7:00) Bangkok, Hanoi, Jakarta');
119 $opt['8'] = _('(GMT + 8:00) Beijing, Hong Kong, Singapore');
120 $opt['9'] = _('(GMT + 9:00) Seoul, Tokyo, Yakutsk');
121 $opt['9.5'] = _('(GMT + 9:30) Adelaide, Darwin');
122 $opt['10'] = _('(GMT + 10:00) Guam, Papua New Guinea, Sydney');
123 $opt['11'] = _('(GMT + 11:00) Magadan, New Caledonia, Solomon Islands');
124 $opt['12'] = _('(GMT + 12:00) Auckland, Wellington, Fiji');
130 /*=====================================================================*\
131 || ###################################################################
134 || ###################################################################
135 \*=====================================================================*/