Subject RE: [firebird-support] Age Calculation
Author Svein Erling Tysvær
I simply do

Case
//After or on birthdate
when extract(month from Current_Date) > extract(month from BirthDate)
or (extract(month from Current_Date) = extract(month from BirthDate)
and extract(day from Current_Date) >= extract(day from BirthDate)) then
extract(year from Current_Date) - extract(year from BirthDate)
else
//Before birthdate
extract(year from Current_Date) - extract(year from BirthDate) - 1
end

or (when not being all too important that the age is 100% correct)

(Current_Date - BirthDate) / 365.25

Though I'm too old fashioned and know nothing about DateDiff or other similar functions,
Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of gorepj
Sent: 28. november 2008 13:35
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Age Calculation

I need to add a computed column to a table to evaluate a person's age.
What is the best way to calculate age? DateDiff(Year, BirthDate,
CURRENT_DATE) seems only to take account of the year portion of the
dates and not the month and day parts.
Regards
Peter Gore
Using FB2.1