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


>
>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)
>
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform