Edit report at https://bugs.php.net/bug.php?id=60176&edit=1
ID: 60176
User updated by: sombra2eternity at gmail dot com
Reported by: sombra2eternity at gmail dot com
Summary: date + strtotime fails to calculate date
-Status: Feedback
+Status: Open
Type: Bug
Package: Date/time related
Operating System: Ubuntu
-PHP Version: 5.3.8
+PHP Version: 5.4
Block user comment: N
Private report: N
New Comment:
I just compiled: php5.4-201110311230
-------------------
desktop7@desktop7-desktop:~/php5.4-201110311230/sapi/cli$ ./php -v
PHP 5.4.0RC1-dev (cli) (built: Oct 31 2011 15:21:08)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies
-------------------
desktop7@desktop7-desktop:~/php5.4-201110311230/sapi/cli$ ./php
/var/www/strto.php
2011-10-30
CONTENT OF STRTO.PHP:
<?php
date_default_timezone_set('Europe/Madrid');
echo date('Y-m-d',strtotime('2011-10-30')+86400);
?>
Thanks for helping me
Previous Comments:
------------------------------------------------------------------------
[2011-10-31 14:01:32] [email protected]
I can't reproduce this with PHP_5_3 HEAD.
Could you please check that your "date.timezone" is set correctly in your
php.ini?
It could help to compare "Y-m-d H:i:s" output.
------------------------------------------------------------------------
[2011-10-31 00:20:04] sombra2eternity at gmail dot com
Description:
------------
Dont know if corrected in new versions but I cant actually upgrade so I write
it here anyway to be sure its reported.
Strtotime/date fails to get the date in a simple test.
I think I found a bug:
echo date("Y-m-d",strtotime('2011-10-30')+86400);
//returns 2011-10-30 and should return 2011-10-31
desktop7@desktop7-desktop:~$ php -v
PHP 5.3.5-1ubuntu7.3 with Suhosin-Patch (cli) (built: Oct 13 2011 21:56:07)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Test script:
---------------
echo date("Y-m-d",strtotime('2011-10-30')+86400);
Expected result:
----------------
2011-10-31
Actual result:
--------------
2011-10-30
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60176&edit=1