Helpful Information
 
 
Category: vBulletin 2.x Beta Releases
My first one - the standards/cities of timezone display

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:
http://forums.sygatetech.com/tzhack/tztemp.gif

The text generated by that (sorry, live demo is not up yet :))
http://forums.sygatetech.com/tzhack/tzss.gif


What to do:

Edit global.php. Find this text:


$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:


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. :D

Sounds good, have an ss?

What's an SS? :confused:

SS (ScreenShot)

Sorry for the lag. Screen shots are on the top post.










privacy (GDPR)