|
Posted by Gordon Burditt on 06/14/07 04:23
>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?
There are an infinite number of possible timezones. Most of them,
such as the one exactly 100 * pi hours west of GMT, are not used
by anyone (at least not anyone sane).
>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(). However, it may be much simpler to
just use the time zone specified as the local time zone and use
functions such as localtime() or date() to compute human-readable
local times.
Navigation:
[Reply to this message]
|