title: How to check if 2 different format date strings is a valid dates?
body: <p>I need to check if 2 different format date strings is a valid dates. The formats are: <code>YYYY-MM-DD</code> and <code>YYYY.MM.DD</code>. I found just only one date string format validation, like so:</p>
  
  <pre><code>function validateDate($date)
  {
      $d = DateTime::createFromFormat('Y-m-d', $date);
      return $d &amp;&amp; $d-&gt;format('Y-m-d') == $date;
  }
  </code></pre>
  
  <p><sup><em>function was copied from this <a href="https://stackoverflow.com/a/12323025/67332">answer</a> or <a href="http://www.php.net/manual/en/function.checkdate.php#113205" rel="nofollow noreferrer">php.net</a></em></sup></p>
  
  <p>But how about two date formats validation? How to solve it? Thanks for any help</p>