Compare two dates in PHP

<?php // Find out whether Cosmonautics Day passed this year or not // Today date in month-day format $today_m_d = date("m-d"); $cosmo = "04-12"; // Include utils.php if ($today_m_d > $cosmo) { echo"Cosmonautics Day already passed this year"; } else { echo"Cosmonautics Day is not celebrated yet"; }; ?>

Cosmonautics Day already passed this year

Banner image

Article author: Andrei Olegovich