title: Change datetime format to Y-m-d, but the datetime is like 7/12/17 6:20:39 pm
body: <p><strong>EDIT :</strong></p>
  
  <p>I need to change this datetime into <code>Y-m-d H:i:s</code> format from <code>dd/mm/yy H:i:s</code> format.</p>
  
  <p>This is for PHP or CodeIgniter project.</p>
  
  <hr>
  
  <p>I got some data from other report not formatted well.</p>
  
  <pre><code>datetime
  7/12/17 12:15:23 pm (dd/mm/yy H:i:s) format
  8/12/17 5:18:12 am
  20/12/17 5:12:24 pm
  21/12/17 12:17:37 pm
  </code></pre>
  
  <p>If I get example using 1st format date.</p>
  
  <pre><code>$example_date = "7/12/17 12:15:23 pm"; // d F Y : 07-December-2017 12:15:23
  $format_date = $date("Y-m-d", strtotime($example_date));
  </code></pre>
  
  <p>Its printed : <code>2007-12-17 12:15:23</code> It's a wrong result.</p>
  
  <p>In <code>d F Y</code> date it's printed <code>17 December 2007</code> but It's should be <code>07 December 2017</code>. </p>
  
  <hr>
  
  <p>Normally we can change date using like this :</p>
  
  <pre><code>$example_datetime = "13/12/2017 12:08:16 pm"; // (dd/mm/yy H:i:s) format
  $format_date = date("Y-m-d H:i:s", strtotime($example_datetime));
  </code></pre>
  
  <blockquote>
    <p>Result from echo <code>$format_date</code> => <code>2017-12-13 12:08:16</code> is correct. If the year is 2017 and this is what I wanted to.</p>
  </blockquote>