I have 2 dates. I want to get all months with total days in each.
How can I do this in PHP?
For example
$date1 = \'2013-11-13\'
i used timestamp and date:
$date1 = '2013-11-15'; // yy-mm-dd format
$date2 = '2014-02-15';
$d1 = strtotime('2013-11-15');
$d2 = strtotime('2014-02-15');
while ($d1 <= $d2) {
echo date('m-d-Y', $d1)." | ";
echo cal_days_in_month(CAL_GREGORIAN, date('m', $d1), date('Y', $d1)) ."
";
$d1 = strtotime("+1 month", $d1);
}