I want to get the start and end date of the previous calender month.
So, it's July 2012 now, I want the function to return 01 June 2012 as start and 30 June 2012 as the end.
This is my code:
$current_month = date("Y-m-01 00:00:00");
$start_month = strtotime(date("Y-m-d", strtotime($current_month) . " -1 month"));
$end_month = strtotime(date("Y-m-d", strtotime($current_month) . " -1 second"));
echo "Start Month: " . date('Y-m-d',$start_month) . "( " . $start_month . ")<br>";
echo "End Month: " . date('Y-m-d',$end_month) . "( " . $end_month . ")<br>";
But it echo's:
Start Month: 2012-07-01( 1341093600)
End Month: 2012-07-01( 1341093600)
Any idea what I'm doing wrong?