I have the following function:
<?php
$date1="2013-10-11";
$date2="2013-12-12";
$objDateEnd = new DateTime($date2);
$objDateStart = new DateTime($date1);
//var_dump($objDateStart);
$xx = $objDateEnd->format('Y')*360 + $objDateEnd->format('m')*30 + (($objDateEnd->format('d') == 31)?30:$objDateEnd->format('d')) -
($objDateStart->format('Y')*360 + $objDateStart->format('m')*30 + (($objDateStart->format('d') == 31)?30:$objDateStart->format('d')))
+ 1;
//$yy = new DateInterval('P'.$xx.'d');
$yy= DateInterval::createFromDateString('222 days');
//echo $yy->format('%d days');
echo "1st \n";
print_r ($yy);
echo "2nd \n";
$diff=date_diff($objDateStart,$objDateEnd);
print_r ($diff);
?>
Why does the 1st DateInterval Object return the value as [d] => 222
and the 2nd DateInterval Object as [days] => 62
?
What needs to be changed in order for the "222" to appear in the "[days]" tag?