Home / PHP Tips Generated By ChatGPT / Getting the First and Last Day of a Month in PHP Calculate the first and last day of the current month. Source Code $firstDay = date('Y-m-01'); $lastDay = date('Y-m-t'); echo "First Day: $firstDaynLast Day: $lastDay";