generate functionSun, 27 Nov 2022

codeigniter 4 check if date time is tomorrow, today, has passed or other date in the future

function time_check($date) { $date = date("Y-m-d", strtotime($date)); $today = date("Y-m-d"); $tomorrow = date("Y-m-d",strtotime("+1 days")); if ($date == $today) { return "today"; } else if ($date == $tomorrow) { return "tomorrow"; } else if ($date < $today) { return "date has passed"; } else { return "other date in the future"; } }

Questions about programming?Chat with your personal AI assistant