title: Trouble inserting a date into a MySql database
body: <p>I've looked at several of the threads that have to do with this issue and still can't figure out what's going wrong with my code.</p>
  
  <p>I'm bring a date field from my form that is in this format "mm-dd-yyyy", when I bring it to my code to update the date of birth field as "yyyy-dd-mm" I use the following</p>
  
  <pre><code>$birth=$_POST['dateBorn'];
  $dateB = date('Y-d-m',strtotime($birth));
  $finaldateB = ($dateB === false) ? '0000-00-00' : date('Y-d-m',strtotime($dateB));
  </code></pre>
  
  <p>When I echo the values of the variables (using a date of birth of 11-23-2012) I see the following values for them birth = 11-23-2012, dateB = 1969-31-12, finaldateB = 1969-31-12</p>
  
  <p>I'm obviously doing something incorrect and haven't been able to locate where</p>
  
  <p>TIA</p>
  
  <p>In order to get things to function, I've at least discovered a work-around that may not be elegant but gives me the results I need for now</p>
  
  <pre><code> $dateB = $birth;
   $dateborn_a=explode("-",$birth);
   $yearborn = $dateborn_a[2];
   $dayborn = $dateborn_a[1];
   $monthborn = $dateborn_a[0];
   $dateOfBirth=$yearborn."-".$monthborn."-".$dayborn;
  </code></pre>
  
  <p>And then use the value in $dateOfBirth to update the table. It's worked for all the records I've tested it on so far.</p>