I want check whether the date from variable is older than current date about 7 days or more.
Now, I check whether this date is -1 day from current:
$old_email = strtotime($result->repairs_date_received) >= strtotime('-1 day') ? true : false;
I want check whether the date from variable is older than current date about 7 days or more.
Now, I check whether this date is -1 day from current:
$old_email = strtotime($result->repairs_date_received) >= strtotime('-1 day') ? true : false;
UNIX time is in seconds, so you can simply check using basic operators like >
and <
.
$week_ago = strtotime('a week ago');
$check = strtotime($result->repairs_date_received);
if($check > $week_ago){
// date is newer than week
} else {
// date is older than week
}