title: PHP Checking datetime format using preg_match and checkdate wrong result
body: <p>I want to validate datetime format using preg_match() and checkdate() function.
  My format is "dd/MM/yyyy hh:mm:ss".
  What wrong with my code?</p>
  
  <pre><code>function checkDatetime($dateTime){
      $matches = array();
      if(preg_match("/^(\d{2})-(\d{2})-(\d{4}) ([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/", $dateTime, $matches)){
          print_r($matches); echo "&lt;br&gt;";
          $dd = trim($matches[1]);
          $mm = trim($matches[2]);
          $yy = trim($matches[3]);
          return checkdate($mm, $dd, $yy); // &lt;- Problem here?
      }else{
          echo "wrong format&lt;br&gt;";
          return false;
      }    
  } 
  
  //wrong result
  if(checkDatetime("12-21-2000 03:04:00")){
      echo "checkDatetime true&lt;br&gt;";
  }else{
      echo "checkDatetime false&lt;br&gt;";
  }
  
  //correct result
  if(checkdate("12", "21", "2000")){
      echo "checkdate true&lt;br&gt;";
  }else{
      echo "checkdate false&lt;br&gt;";
  }
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>Array ( [0] =&gt; 12-21-2000 03:04:00 [1] =&gt; 12 [2] =&gt; 21 [3] =&gt; 2000 [4] =&gt; 03 [5] =&gt; 04 [6] =&gt; 00 )
  
  checkDatetime false
  
  checkdate true
  </code></pre>