Bug #69786 [Opn]: strtotime troubles when subtracting days

From: Date: Wed, 10 Jun 2015 12:04:09 +0000
Subject: Bug #69786 [Opn]: strtotime troubles when subtracting days
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193300@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69786&edit=1

 ID:                 69786
 Updated by:         cmb@php.net
 Reported by:        s dot rotondo90 at gmail dot com
 Summary:            strtotime troubles when subtracting days
 Status:             Open
 Type:               Bug
 Package:            Date/time related
 Operating System:   Windows Server 2012 R2 Standard
 PHP Version:        5.5.25
 Block user comment: N
 Private report:     N

 New Comment:

Hm, I'm not sure if that is supposed to work. Apparently 'next tue'
is simply ignored and only '-1 day' is calculated.

Anyhow, do you really mean 'next tue -1 day' instead of 'next
mon'? Both have, of course, different results on Mondays.


Previous Comments:
------------------------------------------------------------------------
[2015-06-09 13:57:32] s dot rotondo90 at gmail dot com

Description:
------------
When subtracting days from the next day of the week and today is the same day of the week, strtotime
use the current date instead.  

Test script:
---------------
// Today is 09/06/2015

echo date('d/m/Y', strtotime('next tue'));
echo date('d/m/Y', strtotime('next tue -1 day'));


Expected result:
----------------
16/06/2015
15/06/2015

Actual result:
--------------
16/06/2015
08/06/2015


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69786&edit=1


Thread (6 messages)

« previous php.bugs (#193300) next »