ID: 36748
Updated by: [EMAIL PROTECTED]
Reported By: admin at yawnster dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: WinXP
PHP Version: 5.1.2
New Comment:
No bug here, you're mixing a function that works on local time (mktime)
with one that works on gmt times (gmdate). If you mix that you get time
skews. See the following correct script:
<?php
date_default_timezone_set("Europe/London");
for($i = 1; $i <=12; $i++)
{
$date1 = gmdate('F '.DATE_ISO8601, gmmktime(0, 0, 0, $i, 1,
2006));
echo "with mktime: $date1\n";
}
?>
Previous Comments:
------------------------------------------------------------------------
[2006-03-15 21:25:17] admin at yawnster dot com
http://82.44.194.226/test.php
Its says im in Europe/London which is indeed correct..
I also included the file code within the test.php file so you can see
the problem firsthand..
Alex
------------------------------------------------------------------------
[2006-03-15 21:19:41] [EMAIL PROTECTED]
Works fine, which timezone does the following print:
<?php
echo date("e"), "\n";
?>
------------------------------------------------------------------------
[2006-03-15 18:24:27] admin at yawnster dot com
Description:
------------
The gmdate() function produces March twice and misses out October under
certain conditions.
Reproduce code:
---------------
<div id="month">
<select name="month">
<?php
for($i = 1; $i <=12; $i++)
{
$date = gmdate('F', mktime(0, 0, 0, $i, 1, 2006));
echo("<option value='$i'>$date</option>");
}
?>
</select>
</div>
Expected result:
----------------
Well it should produce a list of the Months in order into a drop-box.
Actual result:
--------------
Well it gives out the 12 months, but goes through March Twice, but
misses out October.. This problem however doesnt occur within the
date() function, so for the time being I'll use this..
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36748&edit=1