|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-10-28 16:28 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 20:00:01 2025 UTC |
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.