0
Guys I have the following code
$date = date('d-m-Y', strtotime($row['data']));
$data_preset = date('Y/m/d');
$diferenca = strtotime($data_preset) - strtotime($row['data']);
$dias = floor($diferenca / (60 * 60 * 24));
echo '<p style="color:#6a727a;">Data do pedido(a):</p><p class="color">'. $row['data'] .'</p></div></div><br>';
if($dias<=15){
echo '<p class="actived">Pedido feito a '. $dias .' dias, está dentro do prazo </p></br>';
}else{
echo '<p class="foraD">Pedido feito a '. $dias .' dias, está fora do prazo, por favor verificar </p></br>';
}
it works fine but I registered a test request on day 2020-09-10 was to accuse that makes 17 days the request was made but is accusing that makes 18 days
i also registered a test request made today 27/09/2020 and is accusing that already 1 day ago the request was made and not 0 days
$Row['data'] is the while that retrieve the date. and I’m making this post at 21:14 on 27/09/2020
If it is a pattern that is responding to the calculation with 1 day more than expected in all situations, why not adjust the code with
-1
?$dias = floor($diferenca / (60 * 60 * 24)) - 1;
– Ademir Mazer Jr - Nuno