Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is best way to calculate age
Message
De
20/09/2006 13:19:07
 
 
À
20/09/2006 13:14:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01155605
Message ID:
01155649
Vues:
115
Yikes!
mdob = {09/25/1960}       && my dob
? YEAR(DATE())-YEAR(mdob) && returns 46
I am NOT 46 yet *G*

>>>We need totals of clients by age bracket. What is the best way to calculate the age? Right now, we are using:
>>>
>>>INT((DATE() - a.dob) / 365)
>>>
>>>But that doesn't take into consideration leap years (which could be significant for someone over 90 years old). Any suggestions? Should I just use:
>>>
>>>INT((DATE() - a.dob) / 365.25)
>>>
>>>Or is there a better (more accurate) way?
>>>
>>>Thanks,
>>>Doug
>>
>>if YEAR is enought:
>>
>>YEAR(DATE())-YEAR(a.dob)
>>
>
>
>Fabio, that doesn't quite work. It only works if you assume rounding. A person born say, November 1, 1975, is normally considered today (Sept. 20, 2006) to be 30 years old. but your calculation gives back 31.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform