This is a nice little snippet to get the first and last dates of a particular month
$Month = 2;
$Year = 2009;
if($Month < 10 && strlen($Month) == 1)
{
$Month = "0".$Month;
}
$MonthStart = $Year."-".$Month."-01"; // first day of a month
$MonthEnd = $Year."-".$Month."-".date("t", strtotime($MonthStart)); // last day of a month
This does come with the caveate, however, that there is no validation on $Year and $Month. If you have $Month = 15 or $Year = “house” then you will have problems, a more advanced method is a topic for another post perhaps!
