title: MySQL: Modifying output of a field for calculation
body: <p>I know calculating age from DOB is relatively simple but I have an issue with different data entry formats in the database. Also, I know this can be easier using PHP, but I don't know PHP and only have MySQL to work with.</p>
  
  <p>The DOB entered into the DB is entered as "month/day/year" or "00/00/0000". But when calculating against today's date, the date would be formatted as "year-month-day" or "0000-00-00". Furthermore, the month placed in the DOB field can have either a one number month (1/01/1999) or a two number month (01/01/1999), so it's not consistent.</p>
  
  <p>I am trying to use the below to utilize CONCAT, SUBSTRING and LOCATE to output the DOB in a better suited format for the age calculation. I think I'm close but not quite there. Any help would be very much appreciated.</p>
  
  <pre><code>SELECT
  CONCAT(SUBSTRING(APPU_DOB,-4,4),'-', SUBSTRING(APPU_DOB,LOCATE('/', APPU_DOB),1),'-',SUBSTRING(APPU_DOB,4,2))       
   FROM APPU_APP_USER
   JOIN APPL_APP ON APPU_APPL_ID = APPL_ID
         WHERE DATE_FORMAT(APPL_CREATE_DT, '%Y-%M-%D') &gt;= '2014-01-01';
  </code></pre>