Reputation: 12275
I am trying to compare two dates, I want to perform an action depending on if the date being checked is more than 24 hours from the current date and time and less than 48 hours, I have some code here but I am not sure how to compare the dates to the 24 and 48 hours, any help would be greatly appreciated:
$dateBeingChecked = /* Queried value */
$todays_date = date("m-d-Y-H-i-s");
$today = strtotime($todays_date);
if ($dateBeingCheckede > $today + /* 24 HOURS FROM NOW */ && $today < $dateBeingChecked + /* 48 HOURS FROM NOW */) {
$valid = "yes";
} else {
$valid = "no";
}
Upvotes: 0
Views: 288