$end_date = "12.05.2016-00:00"; if($end_date > date('dmY-H:i')) { echo "1"; } else { echo "0"; } He must issue 1 and put 0, if you use another date for example: 05/20/2016-00: 00 then he puts 1
date('dmY-H:i')) { echo "1"; } else { echo "0"; } He must issue 1 and put 0, if yo...">
$end_date = "12.05.2016-00:00"; if($end_date > date('dmY-H:i')) { echo "1"; } else { echo "0"; } He must issue 1 and put 0, if you use another date for example: 05/20/2016-00: 00 then he puts 1
These are strings! You do not compare the dates themselves, but the strings by the string comparison rules. Compare time stamps:
$end_date = strtotime("12.05.2016-00:00"); if($end_date > strtotime("now")) { echo "1"; } else { echo "0"; } You can try using datetime . It will be something like this:
$format = 'dmY-H:i'; $end_date= DateTime::createFromFormat($format, '12.05.2016-00:00'); $now = new DateTime(); if($now < $end_date){ return true; } return false; $format = 'dmY-H:i'; - user200141Source: https://ru.stackoverflow.com/questions/512548/
All Articles