The following code will help you to check if a date in the future or in the past. Where are this required? A lot of fields date will require you to check if the date is in the past or in the future.

$time = "2017-09-26";
if(strtotime($time) > time()) {
     //in the future
}

if(strtotime($time) < time()) {
     //in the past
}

if(strtotime($time) == time()) {
    //is right now
}

 

You might find interesting:   Show A List Of Days Between Two Dates in PHP

NO COMMENTS

LEAVE A REPLY