I'm using this code:
$due_date = new DateTime($_POST['due_date']);
$today = new DateTime();
$months = $due_date->diff($today);
$months->format("%m");
$fine = 0.02 * $price * $months; // i got error in this line
$bill = $price + $fine;
I want to calculate, if someone is late to pay then they will be fined per month. And the error message is:
Object of class DateInterval could not be converted to int