Created
April 26, 2020 23:03
-
-
Save Alexander-Pop/2c4ac5476ef48d34a1cd83f8a4204007 to your computer and use it in GitHub Desktop.
PHP Check if current date is between two dates #php #date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$currentDate = date('Y-m-d'); | |
$currentDate = date('Y-m-d', strtotime($currentDate)); | |
$startDate = date('Y-m-d', strtotime("01/03/2020")); | |
$endDate = date('Y-m-d', strtotime("01/13/2020")); | |
if (($currentDate >= $startDate) && ($currentDate <= $endDate)){ | |
echo "Current date is between two dates"; | |
} else { | |
echo "Current date is not between two dates"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment