title: PHP DateTime exception and errors handling
body: <p>How can I prevent PHP to crash when creating a DateTime object?</p>
  
  <pre><code>$in = new DateTime($in);
  $out = new DateTime($out);
  </code></pre>
  
  <p><code>$in</code> and <code>$out</code> both comes from a form so they could be anything. I enforce the user to use a calendar and block it to dates with javascript. What if the user can bypass this check?</p>
  
  <p>If <code>$in = "anything else other than a date"</code> PHP will crash and block the rendering of the whole page.</p>
  
  <p>How do I prevent this and just <code>return(0)</code> if PHP is not able to parse the date?</p>