I am experiencing an issue when comparing two dates in php.
The problem: When comparing 12:00 AM (midnight) to eg 10:00 AM (morning) the following code will not work properly. According to human logic 10:00 AM is later than 12:00 AM. But computers seem not to recognize that.
Is there any way to do this differently?
date_default_timezone_set('Europe/Athens');
$today = date("d-m-Y h:i:s A");
$today = date("d-m-Y h:i:s A",strtotime($today));
$max = date('d-m-Y h:i:s A', strtotime("31-12-2015 23:59:00"));
$min = date('d-m-Y h:i:s A', strtotime("14-12-2015 00:00:01"));
if (($today > $min) && ($today < $max)){
//do something
} else {
//something else done
}