2
Good afternoon. I do not know if it was very clear but the following, use 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, because I need that when the deadline is in delay, I can identify, only that when I make a difference and is late 30 days (-30), my code is interpreting that is missing 30 days, for it is positive. how can I solve, code below:
$database = date_create($row['expira']);
$datadehoje = date_create();
$resultado = date_diff($database, $datadehoje);
$intervalo = date_interval_format($resultado, '%a');
echo $intervalo;