Skip to content

Instantly share code, notes, and snippets.

@mklasen
Created February 28, 2017 13:37
Show Gist options
  • Save mklasen/27eb016a74460171b84b0803ddbb77ff to your computer and use it in GitHub Desktop.
Save mklasen/27eb016a74460171b84b0803ddbb77ff to your computer and use it in GitHub Desktop.
Compare between dates in PHP
$today = new Datetime();
$min = DateTime::createFromFormat('d/m/Y', '25/02/2017');
$max = DateTime::createFromFormat('d/m/Y', '03/03/2017');
if ($min->getTimestamp() <= $today->getTimestamp() && $max->getTimestamp() >= $today->getTimestamp()) {
//
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment