i am using the following code(based on this http://goo.gl/5HhSx) to calculate the difference between dates:
<?php
$date1 = '2012-03-29';
$date2 = '2012-04-02';
$datetime1 = date_create($date1);
$datetime2 = date_create($date2);
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%a days');
?>
The difference is 4 days.March has a fixed price(30€/day) and April has another(40€/day). Is there a way to sum the whole price? Three days until the end of march and another two from april? How can i add them correctly? Any help would be appreciated. Thanks.