I need to add a month to a date. I have tried many different things but keep coming up short. My most recent try is this:
echo date('Y-m-d', strtotime("+1 month", $month[$i]));
This is a var_dump
of $months
. Note that the months are totally subject to change:
array(2) { [0]=> string(10) "2014-04-01" [1]=> string(10) "2014-05-01" }
I am looping through the $months
like this:
for ($i=0; $i < count($months); $i++) { //doing stuff }
where I have a query with a WHERE
clause:
WHERE r.departure >= '".$months[$i]."' AND r.departure < '".date('Y-m-d', strtotime('first day next month',$month[$i]))."'
What I am trying to do is limit each query to between a month and the next month.
Any ideas?