generate functionSun, 27 Nov 2022

php check if given date time has passed or is tomorrow or is today or in the future

function get_date_status($date) { $date = strtotime($date); $current_date = time(); if($date > $current_date) { return 'In the future'; } elseif($date < $current_date) { return 'In the past'; } elseif($date == $current_date) { return 'Today'; } else { return 'Invalid date'; } } get_date_status('2019-02-02 19:00:00');

Questions about programming?Chat with your personal AI assistant