#32640 [Opn]: Bug in either date of gmmktime
| From: | chris at deskpro dot com | Date: | Sat, 09 Apr 2005 00:33:48 +0000 |
| Subject: | #32640 [Opn]: Bug in either date of gmmktime | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76550@lists.php.net to get a copy of this message | ||
ID: 32640
User updated by: chris at deskpro dot com
Reported By: chris at deskpro dot com
Status: Open
Bug Type: Date/time related
Operating System: Linux / Windows
PHP Version: 4.3.9
New Comment:
I will add I get different wrong resuls (but always wrong) based on the
DST setting.
This is only tested on Windows. I am in -8 GMT (PST)
with no dayling savings time (-8 PST) the last result is
NOW - 8 hours (instead of NOW + 8 hours)
When I enable DST (now in PDT) I get
GMT - 2 hours OR NOW + 6 hours
In the 1st one, the difference (8 hours) has been taken away instead of
added; this is probably someone just using a - instead of a +
The problem when DST is enabled I have much less of an idea about.
Previous Comments:
------------------------------------------------------------------------
[2005-04-09 02:16:34] chris at deskpro dot com
Description:
------------
Please run the reproduce code:
In PHP 4.3.9 (windows) and PHP 4.3.7 (linux) I get the same result. 3
results are displayed in local time, 2 are in GMT and 1 (the bottom
one) is meaningless.
It appears that PHP is taking the hours off, not adding them in. I do
not know if this is a bug in date or gmmktime.
Importantly, this does NOT happen in PHP 5, this is what convinced me
this is a bug.
Reproduce code:
---------------
echo "<table>";
echo "<tr><td>gmdate('D, jS M Y g:i a') : </td><td>" .
gmdate('D, jS M
Y g:i a') . "</td></tr>";
echo "<tr><td>date('D, jS M Y g:i a'); : </td><td>" .
date('D, jS M Y
g:i a') . "</td></tr>";
echo "<tr><td>gmdate('D, jS M Y g:i a', mktime()); :
</td><td>" .
gmdate('D, jS M Y g:i a', mktime()) . "</td></tr>";
echo "<tr><td>gmdate('D, jS M Y g:i a', gmmktime()); :
</td><td>" .
gmdate('D, jS M Y g:i a', gmmktime()) . "</td></tr>";
echo "<tr><td>date('D, jS M Y g:i a', mktime()); :
</td><td>" .
date('D, jS M Y g:i a', mktime()) . "</td></tr>";
echo "<tr><td>date('D, jS M Y g:i a', gmmktime()); :
</td><td>" .
date('D, jS M Y g:i a', gmmktime()) . "</td></tr>";
echo "</table>";
Expected result:
----------------
The results should be:
GMT
Local
GMT
Local
Local
GMT
Actual result:
--------------
GMT
Local
GMT
Local
Local
Meaningless
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32640&edit=1