I have a data in a text file saved using date("Y-m-d h:i:s", strtotime("+2 minutes"))
that I need to check if it's 10 minutes ago. I'm trying the following code but it doesn't print anything even if more than 10 minutes ago.
$now = date("Y-m-d h:i:s", strtotime("now"));
if($now > strtotime($old_data))
echo 'expired!';
your comparing a formatted date with a time stamp which explains why nothing works
here:
$now = strtotime("-10 minutes");
if ($now > strtotime($old_data) {
echo 'expired!';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With