What is the best way to calculate the age in years from a birth date in sqlite3?
I found this that maybe would help you:
select
case
when date(dob, '+' ||
strftime('%Y', 'now') - strftime('%Y', dob) ||
' years') >= date('now')
then strftime('%Y', 'now') - strftime('%Y', dob)
else strftime('%Y', 'now') - strftime('%Y', dob) - 1
end
as age
from t;
From http://www.mail-archive.com/sqlite-users@sqlite.org/msg20525.html