Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reliably getting age from DOB and DATE()
Message
 
 
To
27/11/2001 19:55:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00586710
Message ID:
00586781
Views:
15
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform