Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Age calculations
Message
 
 
To
22/01/1999 12:03:32
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00179005
Message ID:
00179036
Views:
32
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform