#47905 [NEW]: strtotime() Reverses Time Zone Offsets
From: casey dot php at caseyftw dot com
Operating system: Ubuntu Linux
PHP version: 5.2.9
PHP Bug Type: Date/time related
Bug description: strtotime() Reverses Time Zone Offsets
Description:
------------
When using strtotime($timezone), where $timezone is the timezone
abbreviation, it adds negative offsets and subtracts positive offsets to
the time.
If you add a date string, e.g. "April 10, 2009 9:20 AM MDT", the same
problem occurs.
Reproduce code:
---------------
<?php
// It is currently 9:55 pm PDT. Default time zone is PDT.
echo date('g:i a', strtotime('HADT')) . " \n";
echo date('g:i a', strtotime('AKDT')) . " \n";
echo date('g:i a', strtotime('PDT')) . " \n"; // This is the only
correct
one.
echo date('g:i a', strtotime('MDT')) . " \n";
echo date('g:i a', strtotime('CDT')) . " \n";
echo date('g:i a', strtotime('EDT')) . " \n";
?>
Expected result:
----------------
7:55 pm
8:55 pm
9:55 pm
10:55 pm
11:55 pm
12:55 am
Actual result:
--------------
11:55 pm
10:55 pm
9:55 pm
8:55 pm
7:55 pm
6:55 pm
--
Edit bug report at http://bugs.php.net/?id=47905&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47905&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47905&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47905&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47905&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47905&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47905&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47905&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47905&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47905&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47905&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47905&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47905&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47905&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47905&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47905&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47905&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47905&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47905&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47905&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47905&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47905&r=mysqlcfg
Thread (2 messages)
- casey dot php at caseyftw dot com