// Get the date in string with Y-m-d format $exp_date_s = "2013-04-22"; $today_s = date("Y-m-d"); // Convert the dates into timestamp $exp_date = strtotime($exp_date_s); $today = strtotime($today_s); // Compare the timestamp if ($exp_date > $today) { // Not yet expired } else { // Expired }
Done =)
Reference: Comparing Dates in PHP
Filed under: PHP Tagged: PHP