Age of a person 
Author Message
 Age of a person

Calculating the age of a person by subtracting their birthdate from the
current date might -not- in fact produce the correct result, due to the
way that leap-years fall.

You should decompose today's date and the birthdate into component parts
and compute the answer in the traditional way:

        { I'm writing this extemporaneously - probably won't compile. }
        DecodeDate(birthDate, birthMo, birthDa, birthYr);
        DecodeDate(date,      thisMo, thisDa, thisYr);

        result := (thisYr - birthYr);
        if (birthMo < thisMo)
           or ((birthMo = thisMo) and (birthDa <= thisDa))
        then inc(result);

This is a literal and straightforward implementation of "how people do

Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259

> Fast(!), automatic table-repair with two clicks of the mouse!
> ChimneySweep(R):  "Click click, it's fixed!" {tm}
> http://www.***.com/

Wed, 18 Jun 1902 08:00:00 GMT
 [ 1 post ] 

 Relevant Pages 

1. Calculating age of a person in PL/SQL

2. how calculate the age of a person??

3. Determining the age of a person if you have date of birth?

4. Computing a person age

5. Calculating a person's age from his birthday

6. How to calculate a person's age?

7. How to determine a person's age

8. Calculating Person's Age

9. Calculate a person's age

10. Calculating a person's age knowing their Date of Birth

11. Calculating person's age from two dates

12. Dbase IV: How to calculate a persons age...

Powered by phpBB® Forum Software