How can I get the last day of the month in PHP?
Given:
$a_date = \"2009-11-23\"
I want 2009-11-30; and given
$a_dat
This should work:
$week_start = strtotime('last Sunday', time());
$week_end = strtotime('next Sunday', time());
$month_start = strtotime('first day of this month', time());
$month_end = strtotime('last day of this month', time());
$year_start = strtotime('first day of January', time());
$year_end = strtotime('last day of December', time());
echo date('D, M jS Y', $week_start).'
';
echo date('D, M jS Y', $week_end).'
';
echo date('D, M jS Y', $month_start).'
';
echo date('D, M jS Y', $month_end).'
';
echo date('D, M jS Y', $year_start).'
';
echo date('D, M jS Y', $year_end).'
';