title: PHP: Date Formatting - MM/DD/YY > YYYY/MM/DD
body: <p>Hi I am trying to get some PHP date formatting resolved. The problem I am having is random unexpected results being returned instead of the correct date after I try and format them.</p>
  
  <p>I have the date <code>MM/DD/YY</code> passed in as a string and I am wondering how to convert that to a <code>YYYY/MM/DD</code>. When it try to convert the date it is like it is staying in the same place but trying to convert the individual section so the <code>MM (12)</code> goes to the year <code>YYYY (2012)</code></p>
  
  <hr/>
  
  <p>Here is the section of code I have been using to try and change the format:</p>
  
  <pre><code>$date = $_GET["datepicker"];
  $arr[$i] = strftime("%Y-%m-%d", strtotime($date));
  </code></pre>
  
  <p>The <code>$arr[$i]</code> is just the array I am putting it into this shouldn't affect anything.
  I have also tried the following:</p>
  
  <pre><code>$arr[$i] = date("Y-m-d", strtotime($date));
  </code></pre>
  
  <p>Thanks,<br/>
  Kieran</p>