What's the issue in a code written for comparing the date with today's date?

前端 未结 3 1681
小鲜肉
小鲜肉 2020-12-07 06:53

I\'m comparing a date with current date(i.e. today\'s date). It is expected that the error should come only when the date to be compared is greater than today\'s date. It sh

3条回答
  •  长情又很酷
    2020-12-07 07:10

    As we have made changes in your code and we test it works from my side so can you try below.

    $submission_date = $_POST['submission_date'];
    $current_date = date('d-m-y H:i:s');
    if (strtotime($submission_date) > strtotime($current_date))
    {
       echo "Future date not accepted";
    }
    

    Hope this helps.

提交回复
热议问题