BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

exact AGE calcuation

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Fiaola
Guest





PostPosted: Thu Mar 03, 2005 3:56 am    Post subject: exact AGE calcuation Reply with quote



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





PostPosted: Thu Mar 03, 2005 6:06 am    Post subject: Re: exact AGE calcuation Reply with quote




"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





PostPosted: Thu Mar 03, 2005 7:28 pm    Post subject: Re: exact AGE calcuation Reply with quote



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





PostPosted: Thu Mar 03, 2005 8:07 pm    Post subject: Re: exact AGE calcuation Reply with quote

Quote:
Nearest AGE depending on the DATE of year.

function YearsBetween(const ANow, AThen: TDateTime): Integer;



Back to top
Patrick
Guest





PostPosted: Thu Mar 03, 2005 8:08 pm    Post subject: Re: exact AGE calcuation Reply with quote

Quote:
function YearsBetween(const ANow, AThen: TDateTime): Integer;
Sorry, I meant to include:


Unit

DateUtils



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.