title: parsing user input to date
body: <p>I have a form where users insert a date
  (<strong>Edit</strong>: the input is copied form documents "as it is" so the formatting my vary)</p>
  
  <p>"2012 12 01"</p>
  
  <p>"2012-12-01"</p>
  
  <p>"2012.12.01"</p>
  
  <p>"01.15.2012"</p>
  
  <p>also some not friendly (but FAST for typing!) inputs like:</p>
  
  <p>"01122012" // 01 12 2012</p>
  
  <p>"011212"   // 01 12 2012</p>
  
  <p>The input format is not fixed so I should make the bast out of what I get ...</p>
  
  <p>Of course there is some priority:</p>
  
  <p>"12.12.12" should be parsed to <strong>yy.mm.dd</strong> IF VALID, or to <strong>dd.mm.yy</strong> as second option.</p>
  
  <p>Most of the ready functions work with "properly formated" content .. so I need a alghorithm
  (or good example code from parsers in other lanuages) </p>