Ask a Question related to PHP Development, Design and Development.
-
sniper@php.net #1
#25981 [Opn->Bgs]: strtotime() returns incorrect date (near daylight saving time change)
ID: 25981
Updated by: [email]sniper@php.net[/email]
Reported By: hazen at edsbits dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Red Hat Linux
PHP Version: 4.3.3
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. Because of this, we hope you add your comments
to the existing bug instead.
Thank you for your interest in PHP.
See bug #20382
Previous Comments:
------------------------------------------------------------------------
[2003-10-24 18:22:35] hazen at edsbits dot com
Description:
------------
I have code which uses human readable text to generate dates for use in
a task management program which stores due dates in a MySQL database.
I have been using the strtotime() function for some months with no
problem. Now that it is near a change in daylight savings time, I'm
finding some odd behavior.
It is currently Friday October 24, 2003.
When I enter "tuesday", the function returns 10-27-2003, not 10-28-2003
as it should. For a sanity check, I also entered "today + 4 days"
which correctly returned 10-28-2003. If I enter "Saturday" or
"Sunday", it correctly returns 10-25-2003 and 10-26-2003 respectively.
Anything after Sunday is off by one day.
Reproduce code:
---------------
<?php
$date_in = $_POST['date_in'];
$date_out = date("Y-m-d", strtotime($date_in));
PRINT<<<END
<H3>strtotime( ) tester</H3>
<PRE>
Input: $date_in
Output: $date_out
</PRE>
<FORM ACTION="datetest.phtml" METHOD="post">
<INPUT TYPE="Text" SIZE="20" NAME="date_in" VALUE="$date_in"><BR>
<INPUT TYPE="Submit" VALUE="Test Date">
</FORM>
END;
?>
Expected result:
----------------
That it returns the correct calendar date
Actual result:
--------------
It returns one day off, as explained in the description above. I also
tested this bug on a second machine running PHP 4.3.2 with the same
result.
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=25981&edit=1[/url]
sniper@php.net Guest
-
CF MX and Daylight Savings Time Change
Next year 2007, the Daylight Saving day (chaning the clocks for spring and fall) will be changing. The Spring date will be a month earlier and the... -
#40100 [NEW]: strtotime() first occurance of weekday returns wrong date
From: support at dailytechnology dot net Operating system: All PHP version: 5.2.0 PHP Bug Type: Date/time related Bug... -
Flex 2 Beta 3 date & daylight savings time issue
I have created an addDay method which takes a date as a parameter and then adds 34 * 60 * 60 * 1000 to it, creates a new date and returns it, but... -
#13984 [Com]: date(I) does not correctly identify daylight saving time
ID: 13984 Comment by: patt_jam at hotmail dot com Reported By: bmplummer1 at home dot com Status: Bogus Bug... -
#24912 [Bgs->Opn]: Date function returns incorrect time zone
ID: 24912 User updated by: mark at katmoda dot com Reported By: mark at katmoda dot com -Status: Bogus +Status: ...



Reply With Quote

