Get the first and the last day of the current month in PHP
If you're new here, you may want to subscribe to my RSS feed.
Thanks for reading my blog!
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