3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $yearMonth = '2017-06'; $startDate = new \DateTime($yearMonth . '-01'); $endDate = clone $startDate; $endDate->modify('last day of this month'); $startDate->modify('monday this week 00:00:00'); $endDate->modify('sunday this week 23:59:59'); var_dump($startDate); var_dump($endDate);
based on lnLvo