Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reliably getting age from DOB and DATE()
Message
 
 
À
27/11/2001 19:55:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00586710
Message ID:
00586781
Vues:
19
>Chris,
>
>This does not work in all cases when a person is born on leap day. It fails when ldDate is Feb. 28 of a non-leapyear. For, example, if lddob is 2/29/1966, and ldDate is 2/28/2001, it returns an incorrect result.
>
>I'm not really trying to be the 'date police'...I just find it a little interesting. *grin*
>

BTW, check relevant FAQ #7922 by Nick Neklioudov

>>
>>Maybe a little unorthodox. But it makes sense to me :)
>>
>>nAge= YEAR(ldDate) - YEAR(ldDob) - IIF(GOMONTH(ldDob, (YEAR(ldDate) - YEAR(ldDob)) * 12) > ldDate, 1, 0)
>>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform