title: php convert date to mysql format
body: <p>I have gone through <a href="https://stackoverflow.com/questions/6790930/convert-php-date-to-mysql-format">convert php date to mysql format</a> but still I have few issues and questions,</p>
  
  <p>In general, my application, can input dates in <code>Y-m-d</code>, <code>d-m-y</code>, <code>m-d-Y</code>, <code>jS</code>, <code>F Y</code> format, or even with <code>'/'</code> separator. </p>
  
  <p>I want this dates to be converted in to <code>MYSQL Y-m-d</code> format,
  I tried as below, but it shows different output than expected,</p>
  
  <p>Non working</p>
  
  <pre><code>date_format(date_create_from_format('d-m-Y', '02-25-2016'), 'Y-m-d');
  </code></pre>
  
  <p>Working</p>
  
  <pre><code>date_format(date_create_from_format('d-m-Y', '25-02-2016'), 'Y-m-d');
  </code></pre>
  
  <p>So it seems format and string to be match in same way, otherwise its not interpreting correctly,</p>
  
  <p>What is best way to convert above 4 format inputs to mysql(Y-m-d) format?</p>
  
  <p>Thanks advanced,</p>