Hi all
I'm working with a couple of date variables to get data from a MySQL database.
$from = date("Y-m-01",strtotime("+$monthnumber months"));
$to = date("Y-m-t",strtotime("+$monthnumber months"));
In the above case, where $monthnumber is zero:
$from = 2009-12-01
$to = 2009-12-31
When $monthnumber is incremented by one:
$from - 2010-01-01
$to = 2010-01-31
... and so on.
This works perfectly when I want to start my reporting loop THIS month.
However, if I want the start month to be LAST month I'm not sure how best to set $from and $to.
If I set $startmonth to 11, what would be the CORRECT way to do the following? (Note this example does not work) :
$from = date("Y-$monthstart-01",strtotime("+$monthnumber months"));
$to = date("Y-$monthstart-t",strtotime("+$monthnumber months"));
I've tried a few mktime excercises but don't seem to be able to find the correct syntax.
Thanks