#32640 [Opn->Bgs]: Bug in either date of gmmktime

From: Date: Sat, 09 Apr 2005 00:35:52 +0000
Subject: #32640 [Opn->Bgs]: Bug in either date of gmmktime
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76552@lists.php.net to get a copy of this message
ID: 32640 Updated by: sniper@php.net Reported By: chris at deskpro dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Linux / Windows PHP Version: 4.3.9 New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. Try search bugs once before reporting this issue for the 100th time.. Previous Comments: ------------------------------------------------------------------------ [2005-04-09 02:33:47] chris at deskpro dot com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#76552) next »