I've got this filed in database stored as type DATETIME.
Consider the value for it: 2017-12-14 16:17:21
And this is my program logic. I want to check if 72 hours passed else echo you need to wait 48 hours and 22 minutes and 55seconds for example.
$row = $res->fetch_assoc();
$last_dl = $row['last_dl'];
// To seconds from 1970
$last_dl = strtotime($last_dl); //120
$seventy_two_hours_in_seconds = 60 * 60 * 72;
if (time() > ($last_dl + $seventy_two_hours_in_seconds)) {
echo "72 Passed";
} else {
echo "You need to wait: " . date('H/h i/m s/s',mktime(0, 0, ($last_dl + $seventy_two_hours_in_seconds) - time()));
}
What is wrong with the logic. Cause it shows way less hours.