#22652 [Opn->Asn]: Please add functions to convert between timezones
| From: | derick@php.net | Date: | Mon, 14 Jun 2004 12:34:40 +0000 |
| Subject: | #22652 [Opn->Asn]: Please add functions to convert between timezones | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60879@lists.php.net to get a copy of this message | ||
ID: 22652
Updated by: derick@php.net
Reported By: photon at comcast dot net
-Status: Open
+Status: Assigned
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 4.3.1
-Assigned To:
+Assigned To: derick
New Comment:
This is in the works for PHP 5.1, please be patient for a while.
Previous Comments:
------------------------------------------------------------------------
[2004-06-14 14:29:03] daniel at NO dot brightbyte dot SPAM dot de
The lack of timezone-conversion function is really a major problem.
Please supply that functionality, there are plenty of libs out there to
build on.
With to regards to what the original author suggested: functions like
converttime() are a BAD idead, as they suggest converting the
time-stamp -- which is, by definition, always in UTC. Instead, it would
be much better to give the date() function an optional third parameter:
the time zone. This would be consistent with the way this is handeled
in other languages, like Perl. For a start, it would even be sufficient
to only allow simple offsets of the form +0500 there -- but it would
indeed be extremely helpful to allow DST-Aware zones (like Olson-DB
zones).
I currently have this problem with a server in germany, that needs to
display Vancouver time. As i don't want to do all the DST-conversion by
hand, i'm stuck with using an external tool (written in perl) to
convert from a unix-timestamp to a Vancouver date. This works well, but
it's extremely slow. Also, it requires installation of a bunch of
Perl-Modules on the server....
Oh, yea: this feature is still lacking under 4.3.4, and i see no
mention in the documentation of supplying something like that in PHP
5... please, do!
thanks.
------------------------------------------------------------------------
[2003-03-11 23:02:21] photon at comcast dot net
Hi,
PHP seems to have some innate knowledge of time zones, but I find it
very lacking for this very simple thing. Say I have a server in
California, but I live in NJ. An m-time, say, of a file on the server
is displayed on my website, but it's in Pacific Time. I want it in
Eastern Time.
It's not as simple as just adding 3 hours either, as Daylight Savings
Time must be taken into effect. Not just one DST crossover either, as
the crossovers will be at different times.
To these ends, I propose three new date functions for PHP: a
generalized converttime(int timestamp, string timezone1, string
timezone2) which could be used easily to convert a time between two
known DAYLIGHT-AWARE time zones, like so:
echo converttime(time(), PT, ET)
It would take the timestamp, see if it was daylight-time in PT,
calculate the offset, check same for ET, convert.
Also convertfromlocal which could do this (known ET timestamp, want to
convert to local time):
echo convertfromlocal(time(), ET)
and convertolocal (say I knew I had a PT timestamp and I wanted it in
ET (with the machine running on PST))
echo converttolocal(time(), PT)
Thank you :)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22652&edit=1