Version: 1.00, by Stoned Gecko
Developer Last Online: Feb 2005
Version: 2.2.x
Rating:
Released: 02-08-2002
Last Update: Never
Installs: 1
Is in Beta Stage
No support by the author.
Preface:
I wanted to display the actual timezone text on the forum in addition to the GMT offset. Since I couldn't find anything here, I did it myself. Now I'm sure there is an easier way of doing this, however I have never touched PHP before. So this is the only way I could figure out how to do this. However since I managed to do it, I thought I'd share it .
What it does:
This basically creates a $timezonetext variable that can be used in templates. The variable contains the text for the appropriate timezone the user selected. For example if the user selected GMT -8, $timezone would contain "US/Pacific Time (US & Canada)".
What it looks like:
The contents of the timezone template:
The text generated by that (sorry, live demo is not up yet )
What to do:
Edit global.php. Find this text:
PHP Code:
$timediff='';
if ($bbuserinfo['timezoneoffset']!=0) {
if (abs($bbuserinfo['timezoneoffset'])==1) {
$timediff=" $bbuserinfo[timezoneoffset] hour";
} else {
$timediff=" $bbuserinfo[timezoneoffset] hours";
}
}
Then right below that add this:
PHP Code:
switch ($bbuserinfo['timezoneoffset']) {
case (-12):
$timezonetext="Eniwetok, Kwajalein";
break;
case (-11):
$timezonetext="Midway Island, Samoa";
break;
case (-10):
$timezonetext="US-Hawaii";
break;
case (-9):
$timezonetext="US-Alaska";
break;
case (-8):
$timezonetext="US/Pacific Time (US & Canada)";
break;
case (-7):
$timezonetext="US/Mountain Time (US & Canada)";
break;
case (-6):
$timezonetext="US/Central Time (US & Canada), Mexico City";
break;
case (-5):
$timezonetext="US/Eastern Time (US & Canada)";
break;
case (-4):
$timezonetext="Atlantic Time (Canada), Caracas, La Paz";
break;
case (-3.5):
$timezonetext="Newfoundland";
case (-3):
$timezonetext="Brazil, Buenos Aires, Georgetown";
break;
case (-2):
$timezonetext="Mid-Atlantic";
break;
case (-1):
$timezonetext="Azores, Cape Verde Islands";
break;
case (0):
$timezonetext="Western Europe Time, London, Casablanca";
break;
case (1):
$timezonetext="Central Europe Time, Brussels, Copenhagen, Paris";
break;
case (2):
$timezonetext="Eastern Europe Time, Kaliningrad, South Africa";
break;
case (3):
$timezonetext="Moscow, St. Petersburg, Baghdad, Kuwait";
break;
case (3.5):
$timezonetext="Tehran";
break;
case (4):
$timezonetext="Muscat, Baku, Tbilisi";
break;
case (4.5):
$timezonetext="Kabul";
break;
case (5):
$timezonetext="Ekaterinburg, Islamabad";
break;
case (5.5):
$timezonetext="Bombay, New Delhi";
break;
case (6):
$timezonetext="Almaty, Dhaka";
break;
case (7):
$timezonetext="Bangkok, Hanoi";
break;
case (8):
$timezonetext="Beijing, Perth, Singapore, Hong Kong";
case (9):
$timezonetext="Tokyo, Seoul, Osaka";
break;
case (9.5):
$timezonetext="Adelaide, Darwin";
break;
case (10):
$timezonetext="Eastern Australian Standard, Guam, Papua New Guinea, Vladivostok";
break;
case (11):
$timezonetext="Magadan, Solomon Islands";
break;
case (12):
$timezonetext="Auckland, Wellington, Fiji, Kamchatka";
break;
}
Hope someone finds this usefull besides me.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.