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:24:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00586710
Message ID:
00586839
Views:
17
I tried yours first and it failed on the birthday coming up with an age that was one year too young. That was why I added 10000 to the first calc, to adjust for the testing date being the birthday.


>Doesn't this work for all cases?
>
>floor((val(dtos(lddate))-val(dtos(lddob)))/10000)
>
>
>>Cy,
>>
>>Just playing I came up with this one;
>>
>>
>>floor(INT((VAL(DTOS(ldDate))-VAL(DTOS(ldDob)))+10000)/10000)
>>
>>
>>ldDate is the day you want age for
>>ldDob is the date of birth
Previous
Reply
Map
View

Click here to load this message in the networking platform