You are here: Re: How to Enumerate and Calculate Timezones? « PHP Programming Language « IT news, forums, messages
Re: How to Enumerate and Calculate Timezones?

Posted by David T. Ashley on 06/14/07 04:52

"Gordon Burditt" <gordon@hammy.burditt.org> wrote in message
news:1371gmc1eq1qp5f@corp.supernews.com...
> >In a web database (PHP), per user, I'd like to allow each user to specify
>>their timezone (this would change how times are adjusted for display for
>>that user).
>>
>>How do I enumerate all possible timezones from a PHP script or compiled
>>'C'
>>program?
>
>>Given a specific timezone, how do I get the time adjustment from UTC
>>(which
>>can vary, based on daylight savings rules)?
>
> You can get a list of tzinfo-supplied timezones in PHP with
> timezone_abbreviations_list() or timezone_identifiers_list(). For
> C, you could try enumerating the files in the tzinfo directory.
> You may get multiple names for the same time zone. For the offset,
> look at timezone_offset_get().

I'm locked into using PHP 4 for reasons that are too long to mention here.
The functions cited are available starting in PHP 5. Thanks, though.

In the /usr/share/zoneinfo directory (I'm assuming that is what you meant),
there are a bunch of files and directories, but they seem to have binary
contents, and I don't know the format. Enumerating the directory tree is no
problem, just that I don't know what is what in terms of relationship to
UTC.

For example:

[dashley@pamc zoneinfo]$ ls
Africa Chile Factory Iceland Mexico posix Universal
America CST6CDT GB Indian Mideast posixrules US
Antarctica Cuba GB-Eire Iran MST PRC UTC
Arctic EET GMT iso3166.tab MST7MDT PST8PDT WET
Asia Egypt GMT0 Israel Navajo right W-SU
Atlantic Eire GMT-0 Jamaica NZ ROC zone.tab
Australia EST GMT+0 Japan NZ-CHAT ROK Zulu
Brazil EST5EDT Greenwich Kwajalein Pacific Singapore
Canada Etc Hongkong Libya Poland Turkey
CET Europe HST MET Portugal UCT
[dashley@pamc zoneinfo]$ cd Brazil/
[dashley@pamc Brazil]$ ls
Acre DeNoronha East West
[dashley@pamc Brazil]$ cat Acre
f\PP@8PPܹu@1P@ݶPTO@z@P:QHP@
"PɪPx Q 3!
P"
p LMTACSTACT[dashley@pamc Brazil]$

Thanks, Dave.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация