From:             photon at comcast dot net
Operating system: Linux
PHP version:      4.3.1
PHP Bug Type:     Feature/Change Request
Bug description:  Please add functions to convert between timezones

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 bug report at http://bugs.php.net/?id=22652&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22652&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22652&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22652&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22652&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22652&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22652&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22652&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22652&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22652&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22652&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22652&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22652&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22652&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22652&r=gnused

Reply via email to