Thanks, Glenn.
Albert

Glenn Smith wrote:
Albert,

I have a piece of code that gives me the integer age as of any given date.  May 
work for you.  You provide dates for vdate and vbirthdate.  Desired output is 
an integer age in variable vyear.

This was not a critical result for my app - thus I have never tested it 
extensively.  While I think the logic is sound, it might be worth testing 
should you choose to use it.

set var vmonth = ((imon(vdate)) - (imon(vbirthdate)))
set var vday   = ((iday(vdate)) - (iday(vbirthdate)))
set var vyear  = ((iyr(vdate))  - (iyr(vbirthdate)))

if vmonth < 0 then
  set var vyear = (vyear - 1)
endif

if vmonth = 0 then
  if vday < 0 then
    set var vyear = (vyear - 1)
  endif
endif



Reply via email to