| View previous topic :: View next topic |
| Author |
Message |
Fiaola Guest
|
Posted: Thu Mar 03, 2005 3:56 am Post subject: exact AGE calcuation |
|
|
Hi,
I'm trying to calculate for an exact AGE of a person using TODAY'S date
and the Person's BirthDate.
Here is what i'm doing but I need it to be exact.
dmMaster.qryM.FieldByName('Age').AsVariant :=
YearOf(Date) -
YearOf(dmMaster.qryM.FieldByName('BirthDate').AsVariant);
Some sample code would be great.
Thanks.
|
|
| Back to top |
|
 |
John Herbster Guest
|
Posted: Thu Mar 03, 2005 6:06 am Post subject: Re: exact AGE calcuation |
|
|
"Fiaola" <nospam-teeleaf96799 (AT) yahoo (DOT) com> wrote
| Quote: | I'm trying to calculate for an exact AGE of a person
using TODAY'S date and the Person's BirthDate.
|
Fiaola,
How *exact* do you want to be?
Do you want to include time zone changes?
What about time of day changes?
Rgds, JohnH
|
|
| Back to top |
|
 |
Fiaola Guest
|
Posted: Thu Mar 03, 2005 7:28 pm Post subject: Re: exact AGE calcuation |
|
|
Nearest AGE depending on the DATE of year.
If a person was born December 20, 1962, then today, he/she will be 42 and
not 43.
"John Herbster" <herb-sci1_AT_sbcglobal.net> wrote
| Quote: |
"Fiaola" <nospam-teeleaf96799 (AT) yahoo (DOT) com> wrote
I'm trying to calculate for an exact AGE of a person
using TODAY'S date and the Person's BirthDate.
Fiaola,
How *exact* do you want to be?
Do you want to include time zone changes?
What about time of day changes?
Rgds, JohnH
|
|
|
| Back to top |
|
 |
Patrick Guest
|
Posted: Thu Mar 03, 2005 8:07 pm Post subject: Re: exact AGE calcuation |
|
|
| Quote: | Nearest AGE depending on the DATE of year.
|
function YearsBetween(const ANow, AThen: TDateTime): Integer;
|
|
| Back to top |
|
 |
Patrick Guest
|
Posted: Thu Mar 03, 2005 8:08 pm Post subject: Re: exact AGE calcuation |
|
|
| Quote: | function YearsBetween(const ANow, AThen: TDateTime): Integer;
Sorry, I meant to include: |
Unit
DateUtils
|
|
| Back to top |
|
 |
|