I am making a code that calculates interest and penalties on PHP based on the amount of days late. But I'm having trouble getting the date and doing this calculation.
$databx = new DateTime();
$datavc = new DateTime($bxgst->getDatavencto()); //2018-10-30
$diasatraso = $databx->diff($datavc)->format('%a');
$vm = (($vlprogramado * $vlmulta) / 100);
$vj = (((($pjuros / 30) / 100) * $diasatraso) * 500) + 500;
In this case, today it shows 11 days, and shows as if it was delay, but it is not, it is 11 days in advance, not late.
What would be the best solution?