how to find Age --using DOB and currDate

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
reddysrc
Participant
Posts: 39
Joined: Mon May 30, 2005 3:19 pm

how to find Age --using DOB and currDate

Post by reddysrc »

Hi Experts,


I had a req to find member_Age using his DateOfBirth and currrentDate()
finally a need to get Age in years.

i am using 7.5 Parallel in AIX env.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How about DaysFromDateSince() and then divide by 365?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

365.25 would be closer, and 365.249 even closer (for really long-lived folks). But better would be to compare the dates properly - subtract the years and then add one if the birthdate has already gone past in the current year.

Beware of other cultural conventions. In some Chinese applications, a child is deemed to be 1 at birth. This would affect your arithmetic.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply