Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Age calculations
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00179005
Message ID:
00179036
Vues:
33
>greetings to all
>
>i need the code for calculating the age as follows:
>i habe a field where we input the date.
>i need to calculate the age on another field based on the current date
>
Here is a one liner...

ldMdate is the date of which you determine the age
ldDob is the date of birth

age = iff((month(ldMdate)*100 + day(ldMdate)) >= (month(ldDob)*100 + day(ldDob)),year(ldMdate) - year(ldDob),year(ldMdate) - year(ldDob) - 1))

With this method, you don't rely on estimating the length of a year and it will give the age in terms of the common usuage.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform