Get Age Using Mysql Functions

Get Age Using Mysql Functions:


·         select (YEAR(CURRENT_DATE()) – YEAR(‘2004-05-05’) –


‘-‘, MONTH(‘2004-01-02’), ‘-‘, DAYOFMONTH(‘2008-01-02’))))) AS `age`


·         SELECT YEAR(DATE_SUB(NOW(), INTERVAL TO_DAYS(‘2004-01-02’) DAY)) AS age

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image