Bug #60176 [NEW]: date + strtotime fails to calculate date

From: Date: Mon, 31 Oct 2011 00:20:04 +0000
Subject: Bug #60176 [NEW]: date + strtotime fails to calculate date
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-164696@lists.php.net to get a copy of this message
From:             
Operating system: Ubuntu
PHP version:      5.3.8
Package:          Date/time related
Bug Type:         Bug
Bug description:date + strtotime fails to calculate date

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 bug report at https://bugs.php.net/bug.php?id=60176&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=60176&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=60176&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=60176&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=60176&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60176&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=60176&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=60176&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=60176&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=60176&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=60176&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=60176&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=60176&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=60176&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=60176&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=60176&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60176&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=60176&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=60176&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=60176&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=60176&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=60176&r=mysqlcfg



Thread (5 messages)

« previous php.bugs (#164696) next »