title: PHP convert date to mm-dd-YYYY to YYYY-mm-dd
body: <p>My problem is that when I try to save in my database a date I receive this date: <code>1970-01-01</code></p>
  
  <p>This is my html code:</p>
  
  <pre><code>&lt;input type="text" name="dob" value="&lt;?php echo $rows['dob']; ?&gt;" required title="The Date of Birth is required" pattern="(0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])[-](19|20)\d\d"&gt;&lt;/input&gt;
  </code></pre>
  
  <p>And this my php code to get the value:</p>
  
  <pre><code>$dob = $_POST['dob'];
  echo $dob.'&lt;br&gt;';
  $dob_new = date('Y-m-d', strtotime($dob));
  echo $dob_new.'&lt;br&gt;';
  </code></pre>
  
  <p>This is the result:</p>
  
  <pre><code>01-22-1984
  1970-01-01
  </code></pre>
  
  <p>The first date is one example that a date that the user can enter and the second date is the result of the conversion!</p>
  
  <p>The mystery is that sometimes this work but sometimes no... so what happen here? Any suggestion? Any error in my code?</p>