In PHP, is there an easy way to get the first and last date of a month?

$first = date('Y-m-d', mktime(0, 0, 0, $month, 1, $year));
$last = date('Y-m-t', mktime(0, 0, 0, $month, 1, $year));

See date() in PHP documentation.

Leave a Comment