One Star

[resolved] How to get age from date of birth

Hi all,
How to calculate the age of a person from his date of birth

My table contains


Sno  Fname    DOB(numeric)


1      Shan       29081990


2      Hani        17071989


My output has to be


Srno  Fname  Age(varchar)


1         Shan        24


2         Hani         25


can some one help me to guide how to solve this


Regards,


Nare

1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] How to get age from date of birth

If you dont know java language
You can use tmap and create Variables 
transform your DOB(numeric) to a date with dateparse
then use datediff
check below

(care its Var.Fulldate not Var.fulldate, i made an error on the screenshoot)
tell me if you dont understand ! (I transform your interger to string, then your string to date)
If you get a negative number, then try TalendDate.diffDate(TalendDate.getCurrentDate(), Var.FullDate,"yyyy")  
2 REPLIES
Five Stars

Re: [resolved] How to get age from date of birth

One Star

Re: [resolved] How to get age from date of birth

If you dont know java language
You can use tmap and create Variables 
transform your DOB(numeric) to a date with dateparse
then use datediff
check below

(care its Var.Fulldate not Var.fulldate, i made an error on the screenshoot)
tell me if you dont understand ! (I transform your interger to string, then your string to date)
If you get a negative number, then try TalendDate.diffDate(TalendDate.getCurrentDate(), Var.FullDate,"yyyy")