0
I am trying to make this code work properly, but the same as I realized only compares the day because if it is larger than the current day works correctly, but if it is smaller than the current day presents the error "Your account has expired" It’s like he doesn’t compare month or year! But in case the other topics do not suit me as they are to compare 2 different dates that this stored in the variable, my date is from the database!
$vencimento = $dado['vencimento'];
if (date("d/m/Y") > $vencimento) {
echo "A sua conta expirou";
}
else {
echo "A sua conta ainda não expirou";
}
but in case my date would be the database in case: $maturity = $given['maturity'];
– Masked_
Just put it in the format that is coming from the database in the parameters of the Datetime method::createFromFormat('format', '$given['maturity']');
– Yure Pereira
Solved, thank you, for those who want to use my code if they are in trouble, this ai: $expiration = $given['expiration']; $expiration1 = Datetime::createFromFormat(’d/m/Y', $expiration); if ($today > $expiration1) { echo "...";
 a;}
– Masked_