Here is how to get the first and the last day of the current month in PHP

<?php

if (function_exists('date_default_timezone_set')) {
date_default_timezone_set('America/Toronto');
}

$start_data = date("Y-m-01");
$end_data = date("Y-m-d", strtotime("-1 day +1 month", strtotime(date("Y-m-01"))));

echo $start_data . " " .  $end_data;
// Outputs: 2009-05-01 2009-05-31
?>

Related