title: Check if string has date, any format
body: <p>How do I check if a string can be parsed to a date?</p>
  
  <ul>
  <li>Jan 19, 1990</li>
  <li>January 19, 1990</li>
  <li>Jan 19,1990</li>
  <li>01/19/1990</li>
  <li>01/19/90</li>
  <li>1990</li>
  <li>Jan 1990</li>
  <li>January1990</li>
  </ul>
  
  <p>These are all valid dates. If there's any concern regarding the lack of space in between stuff in item #3 and the last item above, that can be easily remedied via automatically inserting a space in between letters/characters and numbers, if so needed.</p>
  
  <p>But first, the basics:</p>
  
  <p>I tried putting it in an <code>if statement</code>:</p>
  
  <pre><code>if datetime.strptime(item, '%Y') or datetime.strptime(item, '%b %d %y') or datetime.strptime(item, '%b %d %Y')  or datetime.strptime(item, '%B %d %y') or datetime.strptime(item, '%B %d %Y'):
  </code></pre>
  
  <p>But that's in a try-except block, and keeps returning something like this:</p>
  
  <pre><code>16343 time data 'JUNE1890' does not match format '%Y'
  </code></pre>
  
  <p>Unless, it met the first condition in the <code>if</code> statement.</p>
  
  <p>To clarify, I don't actually need the value of the date - I just want to know if it is. Ideally, it would've been something like this:</p>
  
  <pre><code>if item is date:
      print date
  else:
      print "Not a date"
  </code></pre>
  
  <p>Is there any way to do this?</p>