Compare two dates in PHP
| Example | |
| Related articles |
<?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
Article author: Andrei Olegovich