Whew! Thanks to all of you. I'll let you know what the final routine looks like, if you're interested. - Gerry
>>I need to calculate a person's age in years, months, and days. Is there a function, VCX, or something like that, to do that?
>>
>>Thanks!
>>
>>- Gerry
>
>Well, I didn't have much else to do so...
>
>FUNCTION HowOld
>PARAMETERS tdDOB
>LOCAL ldNow, lnYears, lnMonths, lnDays, lnDiffDay
>
>ldNow = DATE()
>lnYears = YEAR( ldNow) - YEAR( tdDOB)
>lnMonths = MONTH( ldNow) - MONTH( tdDOB)
>
>IF lnMonths < 0
> lnYears = lnYears - 1
> lnMonths = lnMonths + 12
>ENDIF
>
>lnDays = DAY( ldNow) - DAY( tdDOB)
>IF lnDays < 0
> lnMonths = lnMonths - 1
> IF lnMonths < 0
> lnYears = lnYears - 1
> lnMonths = lnMonths + 12
> ENDIF
>
> lnDiffDay = 0
> DO WHILE GOMONTH( ldNow, -1) + lnDiffDay <> ldNow
> lnDiffDay = lnDiffDay + 1
> ENDDO
>
> lnDays = lnDiffDay
>ENDIF
>
>? lnYears, lnMonths, lnDays
** Gerry White / Hagerstown, MD, USA --
** Developing since 1986 in Foxpro, VFP, Oracle, and Java.
**
http://GerrysPlace.com