show month and year php from datetime code example
Example 1: datetime get month php
$dateTime = new DateTime();
$month = $dateTime->format('m');
Example 2: get month days in php
echo cal_days_in_month(CAL_GREGORIAN, 8, 2009);
$dateTime = new DateTime();
$month = $dateTime->format('m');
echo cal_days_in_month(CAL_GREGORIAN, 8, 2009);