Options

How to compute age from Birthdate

Hayashi87Hayashi87 Member Posts: 4 Contributor I
edited December 2018 in Help

I have a birthdate field in dd/mm/yyyy? How do you compute age using Generate Attributes?

Answers

  • Options
    Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    date_diff(date_now(),birthday)/(1000*60*60*24*365.25)

  • Options
    Hayashi87Hayashi87 Member Posts: 4 Contributor I

    Thanks Thomas, any idea why I am getting negative values and decimal in my age field?

  • Options
    Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    Try '(Birthday,date_now())' instead. I went off my faulty memory, check the date_diff() function requirements. 

Sign In or Register to comment.