How to calcuate the current AGE

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
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

How to calcuate the current AGE

Post by imfarhan »

I want to calcuate the current AGE.

I have used the function YearFromDate(DOB) but it doesn't like that I think because the field type is timestamp, so i thought first convert into into Date so I tried like : but no success again

Code: Select all

YearFromDate(TimetFromTimestamp(.BIRTH_DTTM))

But not working there is other function called
TimestampFromDateTime(%date%,%time%) but don't know how to pass argument I tried like that

Code: Select all

TimestampFromDateTime(DOB,DOB)
does not like either Thanks for your help
Farhan Syed
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Is the birthdate in the column "BIRTH_DTTM"? If yes, what is the data type and if it is a string, what is the format?

What data type should the output column "AGE" be?
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

Sorry, I should 've put the format.
The type of the field is "TIMESTAMP" AND VALUE keeps like

Code: Select all

1974-11-27 00:00:00.0
I hope it makese sense

To calcuate Age I simply thinking to do following ....CurrenDate() - DOB
Appreciate your advise
Regards
Farhan
Farhan Syed
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

Done! Thanks for your help

Code: Select all

YearFromDate(TimestampToDate(IP_Spell_Epi_HRG_Src.BIRTH_DTTM)) 
Then on next Transformer Stage I sed like that

Code: Select all

YearFromDate(CurrentDate())  - IP_Spell_EPI_HRG_Tariff_Src.Spell_Age
Got the Age
Regards
F
Farhan Syed
Post Reply