Good afternoon. I do not know if it was very clear but the following, date_diff()
, the problem is what, when I convert the interval $intervalo = date_interval_format($resultado, '%a')
if the result is less than 0 the number is positive, and is disturbing my logic, when the deadline is in arrears, I can identify, but when I make the difference and is delayed 30 days (-30), my code is interpreting that it is missing 30 days, because it is positive. how can I solve it, code below:
$database = date_create($row['expira']);
$datadehoje = date_create();
$resultado = date_diff($database, $datadehoje);
$intervalo = date_interval_format($resultado, '%a');
echo $intervalo;