Check if a string is a date
<p>I have some dynamic date values that I am trying to change to a human-readable format. Most of the strings I get are in the format <code>yyyymmdd</code>, for example 20120514, but some are not. I need to skip the ones that re not in that format, because they may be not dates at all.</p>

<p>How do I add such check to my code?</p>

<pre><code>date("F j, Y", strtotime($str))
</code></pre>
