Page 1 of 1

Calculate BIRTH DATE from AGE

Posted: Thu Sep 04, 2014 4:10 am
by naveed.zuber
Please help with below requirement-

Transformer stage below field needs to derive-

BIRTH DATE=CurrentDate() - AGE

Ex:AGE is 38.
BIRTH DATE is DATE field.

Posted: Thu Sep 04, 2014 5:13 am
by atulgoel
Try Below function in transformer in Datastage 8.5 version:

DateOffsetByComponents(%basedate%,%yearoffset%,%monthoffset%,%dayoffset%)

DateOffsetByComponents(CurrentDate(),-38,0,0)

Posted: Thu Sep 04, 2014 7:40 am
by chulett
How can you derive a birthdate from an AGE? Every day the 'birthday' will change. Birth year, perhaps. :?

Posted: Thu Sep 04, 2014 5:03 pm
by ray.wurlod
Resist stupid requirements!

Posted: Thu Sep 04, 2014 7:21 pm
by stuartjvnorton
ray.wurlod wrote:Resist stupid requirements! ...
Should be a t-shirt.

Whoever came up with this requirement needs to be... um... reminded... that you can't invent detail.

Posted: Thu Sep 04, 2014 9:30 pm
by ray.wurlod
Favourite t-shirt ever:

Code: Select all

 ===>
CLOWNS

 <===
JOKERS

Posted: Thu Sep 04, 2014 9:39 pm
by U
Date of birth can be calculated from AGE, if and only if AGE is given in days and time of birth is known.

Posted: Thu Sep 04, 2014 10:34 pm
by naveed.zuber
Yes this is stupid requirement from Customer.
Thanks Atul for your help.

Below transformation function working for me.
DateOffsetByComponents(%basedate%,%yearoffset%,%monthoffset%,%dayoffset%)

DateOffsetByComponents(CurrentDate(),-1*INPUTFIELD,0,0)