1
    $date = $_REQUEST['date'];

    function is_date( $date ) {

       $splitefromdate = explode("-", $date);
       $fromyear = $splitefromdate[0];
       $frommonth = $splitefromdate[1];
       $fromdate = $splitefromdate[2];

       if( checkdate(is_numeric($frommonth), is_numeric($fromdate), 
  is_numeric($fromyear)) )
       {
         return true;
       }
       else 
       {
         return false;
       }
    }
    if(is_date($date))
    {
      echo "valid";
    }
    else
    {
      echo "invalid";
    }

I'm getting date "valid" when input date like this "2019-03-32". Wheter There is no day with '32'. And i'm getting invalid when date is "2019-03-30l".

Abijith P
  • 319
  • 3
  • 10
  • You can also use `&& strtotime($date)` to verify, that will return false for invalid dates. https://3v4l.org/NgZtO – Qirel Mar 29 '19 at 09:35

0 Answers0