Edit report at https://bugs.php.net/bug.php?id=28599&edit=1
ID: 28599
Comment by: gregg dot somes at gmail dot com
Reported by: fr33k at techie dot com
Summary: strtotime fails with certain intervals & zero base
time
Status: Closed
Type: Bug
Package: Date/time related
Operating System: Debian
PHP Version: 4.3.5
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
I am using PHP 5.2.6 on Windows XP personal production server with
Apache/2.0.63 (Win32) PHP/5.2.6 and mySQL Server 5.1.59. I am encountering a
problem with strtotime() function that returns FALSE on certain date strings.
For example strtotime("02-03-2009") returns 1235980800 where
strtotome("03-25-2009") returns FALSE. It appears that it doesn't really
matter what the date strings are that make it fail, for instance 05-07-2009
returns 1246777200 and
05-01-2009 returns 1231142400 however 05-28-2011 returns FALSE as does
05-31-2011
Any suggestions how to overcome this behavior?
Gregg
Previous Comments:
------------------------------------------------------------------------
[2004-11-15 17:31:50] [email protected]
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2004-08-06 09:24:30] derrickbtan at gmail dot com
Same as previous comment: PHP5. +1 day or 24 hour only adds to the day and not
the hours.
$record = time();
echo date( "d:M H:i", $record );
echo "<br>";
echo date( "d:M H:i", strtotime( "+1 day", $record ) );
The relative times are taken from 00:00
dtan
------------------------------------------------------------------------
[2004-07-18 18:19:14] tumpen at fez dot dk
I just experienced some weirdness involving strtotime, don't know if it's the
same as this bug, since I'm not using zero base time.
The following code:
<?php
print date("d-m-Y H:i:s", strtotime("+30 minutes", time()));
?>
gives me, in php4, the correct 30 minutes extra added to current time, eg:
18-07-2004 18:45:21 (when now is 18:15:21)
BUT in php5.0.0, the 30 minutes are added to 00:00:00 at todays date, eg:
18-07-2004 00:30:00, which is of course wrong.
Reproduced on both mandrake and debian installations of php5 in either
cli(mdk)/cgi(deb).
------------------------------------------------------------------------
[2004-06-12 12:13:39] [email protected]
This should be assigned to me...
------------------------------------------------------------------------
[2004-06-12 01:00:03] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=28599
--
Edit this bug report at https://bugs.php.net/bug.php?id=28599&edit=1