title: calculate age in years months and days
body: <p>I got problem using <code>FROM_DAYS</code> function in mysql, i want to get age from my_table, here's my query;</p>
  
  <pre><code>select dob,CURRENT_DATE,
  DATE_FORMAT(FROM_DAYS(DATEDIFF(CURRENT_DATE,dob)),'%y yr %c mth %e dy') AS age, 
  DATEDIFF(CURRENT_DATE,dob) days from my_table
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>dob       || CURRENT_DATE || age              || days  ||
  ==========++==============++==================++=======++
  1953-09-10|| 2013-09-12   || 60 yr 1 mth 3 dy || 21917 ||
  2013-09-08|| 2013-09-12   || 00 yr 0 mth 0 dy ||     4 ||
  </code></pre>
  
  <p>when I tried <code>FROM_DAYS(DATEDIFF(CURRENT_DATE,m.tgllahir))</code> for 2nd row this is the result <code>0000-00-00</code></p>
  
  <p>and then I tried looking at <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html" rel="nofollow">Date and Time Functions</a> and found this </p>
  
  <pre><code>SELECT FROM_DAYS(730669);
          -&gt; '2007-07-03'
  </code></pre>
  
  <p>but when I tried this is what I got; </p>
  
  <pre><code>SELECT FROM_DAYS(730669);
          -&gt; '2000-07-03'
  </code></pre>
  
  <p>I'm curious why <code>FROM_DAYS</code> function not working properly, but my main problem is how to find the age?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>after a discussion with  Barmar I know that I can't use FROM_DAYS to get accurate age, so I  tried to find different method</p>