title: Format date dd/mm/yyyy to yyyy-mm-dd PHP
body: <p>I have a form within which a date is input in UK format, and I need to convert it to </p>
  
  <pre><code>yyyy-mm-dd
  </code></pre>
  
  <p>e.g. a date entered is: <code>31/03/2013</code> which I want to convert to <code>'2013-03-31'</code> for database insert.</p>
  
  <p>I'm using the following which bizarrely works only sometimes:</p>
  
  <pre><code>$dateInput = $mysqli-&gt;real_escape_string($_POST['date']);
  $show_date = date('Y-m-d', strtotime($dateInput));
  </code></pre>
  
  <p>Is there a better way to do this?</p>