title: Convert date mm-dd-yyyy to yyyy-mm-dd in php
body: <p>I want to convert a date field(format: dd-mm-yyyy) to db date format. 
  If input date format is equal to <code>dd-mm-yyyy</code> format then convert date  to <code>yyyy-mm-dd</code> format else return false.</p>
  
  <pre><code>function convertToDbDate($date) {
      if($date !="") {
          $result= date('Y-m-d', strtotime(str_replace('/', '-', $date))); 
          if($result) { 
              return $result; 
          } 
          return false;
      }
  } 
  </code></pre>