stoolpigeon
Programmer
I am curious if anyone can tell me why the first example works and the second does not.
If the value of $data["start_dt"] is 2002-11-10 then the above returns 2002-11-09, which is what I want.
But this statement
For the same value 2002-11-10 is returned. The seven days are not added. I can remove the +7 part and loop through adding one at a time and that works. (that's what I'm doing for now) But I want to understand why I can't add more than one.
What I've done for now looks like this:
That gets me where I want to go but seems less than ideal.
Code:
$sp1 = date("Y-m-d",strtotime($data["start_dt"])-1);
But this statement
Code:
$sp1 = date("Y-m-d",strtotime($data["start_dt"])+7);
What I've done for now looks like this:
Code:
$sp1 = date("Y-m-d",strtotime($data["start_dt"]));
for($i=0;$i<7;$i++) $sp1++;