Skip to content

Instantly share code, notes, and snippets.

@cvergne
Created April 4, 2012 14:23
Show Gist options
  • Save cvergne/2301589 to your computer and use it in GitHub Desktop.
Save cvergne/2301589 to your computer and use it in GitHub Desktop.
Check if date is in defined date range
$startDate = strtotime('2012-04-01');
$endDate = strtotime('2012-04-30');
$searchDate = strtotime('2012-04-18');
if ($searchDate >= $startDate && $searchDate <= $endDate) {
echo 'Notre date recherchée est bien dans la plage spécifiée.';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment