Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Alexander-Pop/2c4ac5476ef48d34a1cd83f8a4204007 to your computer and use it in GitHub Desktop.
Save Alexander-Pop/2c4ac5476ef48d34a1cd83f8a4204007 to your computer and use it in GitHub Desktop.
PHP Check if current date is between two dates #php #date
<?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