Dom:

Use my routine posted earlier, but insert the target date instead of
date():

Suppose variable DOB holds the date of birth in internal format.
Suppose TARGET is the 'as of' date in internal format also.

      DOBX = OCONV(DOB,'D4/')
      DOB.YR = DOBX[7,4]
      DOB.DA = DOBX[4,2]
      DOB.MO = DOBX[1,2]

      TARGETX = OCONV(DATE(),'D4/')
      TARGET.YR = TARGETX[7,4]
      TARGET.DA = TARGETX[4,2]
      TARGET.MO = TARGETX[1,2]

      AGE = TARGET.YR - DOB.YR
      * We will subtract 1 from age if the 'now' month & day is earlier
in the
      * year than the 'dob' month & day, otherwise not

      IF TARGET.MO < DOB.MO THEN
         AGE = AGE - 1
      END ELSE
         IF TARGET.MO = DOB.MO AND TARGET.DA < DOB.DA THEN
            AGE = AGE - 1
         END
      END
      * The variable AGE now holds their age as of the target date.

Harold Oaks
Sr. Programmer/Analyst
Clark County, WA

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Darren
Macdonald
Sent: Wednesday, January 17, 2007 4:57 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [UV] Calculate age from date of birth

Perhaps a better way to do this would be to calculate a 'born before
date'.

This may save on processing time as well...

So, everyone born before 17/01/1942 is 65 or older.

HTH

Darren

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dominion
Sent: 16 January 2007 21:05
To: u2-users@listserver.u2ug.org
Subject: [U2] [UV] Calculate age from date of birth

Hi,
Could anyone tell me how I can calculate someones age from their date of
birth at a specific point in time? ie, age at 6 April 2006 if their date
of birth is 12 October 1967.

Thanks,

Dom
--
View this message in context:
http://www.nabble.com/-UV--Calculate-age-from-date-of-birth-tf3023501.ht
ml#a8398858
Sent from the U2 - Users mailing list archive at Nabble.com.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to