Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method to derive age from a birth date in SQLite is as follows:

SELECT strftime('%Y', 'now') - strftime('%Y', birthdate) - (strftime('%m-%d', 'now') < strftime('%m-%d', birthdate)) AS age

Here, the strftime() function is used to extract the year, month, and day from the birth date and the current date. Then, the year difference between the two dates is calculated and adjusted for the birth month and day. Finally, the result is returned as the age.