take a look at rbases iyear, imon, and iday functions to extract date parts and 
calculate on 


here is my age calc that I do...

set var SRv_LastYear date =(addyr(.#date,-1))

update attStR_ReportingPeopInfo set +
attStR_Age='Unknown' +
where attStR_BDate='04/01/1900'

update attStR_ReportingPeopInfo set +
attStR_Age=(ctxt(iyr(.#date)-iyr(attStR_BDate))) +
from attStR_ReportingPeopInfo +
where attStR_BDate<>'04/01/1900' and attStR_BDate<=.SRv_LastYear and 
(imon(attStR_BDate))<=(imon(.#date))

update attStR_ReportingPeopInfo set +
attStR_Age=(ctxt(iyr(.#date)-iyr(attStR_BDate)-1)) +
from attStR_ReportingPeopInfo +
where attStR_BDate<>'04/01/1900' and attStR_BDate<=.SRv_LastYear and 
(imon(attStR_BDate))>(imon(.#date))

--less then a year old
update attStR_ReportingPeopInfo set +
attStR_Age=(ctxt((imon(.#date)+12)-imon(attStR_BDate))+' mos') +
from attStR_ReportingPeopInfo +
where attStR_BDate>.SRv_LastYear and (imon(attStR_BDate))>(imon(.#date))

update attStR_ReportingPeopInfo set +
attStR_Age=(ctxt((imon(.#date))-imon(attStR_BDate))+' mos') +
from attStR_ReportingPeopInfo +
where attStR_BDate>.SRv_LastYear and (imon(attStR_BDate))<(imon(.#date))

update attStR_ReportingPeopInfo set +
attStR_Age='1 mos' +
from attStR_ReportingPeopInfo +
where attStR_BDate>.SRv_LastYear and imon(attStR_BDate)=imon(.#date)

Have a Fabulous Day!
Rachael M.
Freelance Developer
www.DragonflyDevelopmentMN.com
  ----- Original Message ----- 
  From: Gray, Damon 
  To: RBASE-L Mailing List 
  Sent: Wednesday, November 19, 2008 12:26 PM
  Subject: [RBASE-L] - Something similar to DateDiff


  I'm trying to code up something that does what SQL's DateDiff( ) does so that 
I can calculate a person's age from their Date of Birth.   This is proving to 
be a significant challenge.  Has someone done this?  R:Base 6.5++

   

   

   

                 wwwww

                 (   @  @   )

  -------oOO---(_)---OOo-------

                  Damon J. Gray

  Anvil Corporation Business Services

                     (360) 937-0770

            oooo0  0oooo

            (        )   (        )

  ----------\    (----)     /-----------

                 \__)   (__/

   

Reply via email to