>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement