Re: [PHP] Time Zone names

2005-07-13 Thread Philip Hallstrom

I'd like to generate a list of time zones (EST, CDT, whatever) for a popup.

Seems like it should be easy...

This is so the Sales guy can just plug in the time and zone of who he's
gotta call back, and I stuff that in the database, and he gets a morning
report of who to call.

$z\n";
 }
?>

What can I use for ??? to get the time zone name for offsets?


We did this for our app... we're always on FreeBSD though, but I imagine 
the same files exist on Linux/others just somewhere else...


define("ZONETAB", "/usr/share/zoneinfo/zone.tab");
$fd = @fopen(ZONETAB, "r");
if (!$fd) {
print("GMT");
} else {
while (!feof($fd)) {
$line = fgets($fd);
if (ereg("^US\t", $line)) {
list($x, $x, $tz_file, $tz_name) = explode("\t", 
trim($line));

print("$tz_name");
}
}
fclose($fd);
}

Gives you a kind of odd format though (we needed the actual timezone file name,
not the offset), but maybe this gets you closer...

Eastern Time
Eastern Time - Michigan - most locations
Eastern Time - Kentucky - Louisville area
Eastern Time - Kentucky - Wayne 
County
Eastern Standard Time - Indiana - most 
locations
Eastern Standard Time - Indiana - 
Crawford County
Eastern Standard Time - Indiana - Starke 
County
Eastern Standard Time - Indiana - 
Switzerland County
Central Time
Central Time - Michigan - Wisconsin border
Central Time - North Dakota - 
Oliver County
Mountain Time
Mountain Time - south Idaho & east Oregon
Mountain Time - Navajo
Mountain Standard Time - Arizona
Pacific Time
Alaska Time
Alaska Time - Alaska panhandle
Alaska Time - Alaska panhandle neck
Alaska Time - west Alaska
Aleutian Islands
Hawaii

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Time Zone names

2005-07-13 Thread Dotan Cohen
On 7/13/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> I'd like to generate a list of time zones (EST, CDT, whatever) for a popup.
> 
> Seems like it should be easy...
> 
> This is so the Sales guy can just plug in the time and zone of who he's
> gotta call back, and I stuff that in the database, and he gets a morning
> report of who to call.
> 
>for ($offset = 0; $offset <= 23; $offset++){
> $z = ???;
> echo "$z\n";
>   }
> ?>
> 
> What can I use for ??? to get the time zone name for offsets?
> 
> The date() function tells me what time zone the webserver is in, which is
> not even *HIS* time zone, much less the client's.
> 
> The idate() function is not available.
> 
> I can't just shove $offset into putenv("TZ=$offset") -- Apparently, in
> order to set TZ I would need to know, a priori, the name of the time zone,
> so that's not real helpful for what I need.
> 
> I looked at all the User Contributed notes, and none seemed to answer it.
> 
> I suppose I could Google for "PHP time zone" but...
> 
> What am I missing?
> 
> --
> Like Music?
> http://l-i-e.com/artists.htm
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

Richard,
Take a look at wikipedia's timezone page. You could probably parse the
table and get what you want. And it's GPL.
http://en.wikipedia.org/wiki/Time_zone

Dotan
http://lyricslist.com/lyrics/artist_albums/299/krauss_alison.php
Krauss, Alison Song Lyrics

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php