How can I create a new atribute that show the age of people to a specific date?

Tdragi13Tdragi13 Member Posts: 5 Learner I
I need to create a new atribute, and show the age of the people of my database on a specific date? Can I do it with date operators?

Best Answer

  • ceaperezceaperez Member Posts: 522 Unicorn
    Solution Accepted
    Hi @Tdragi13
    Please read this Thread

    Calculating time difference in days between two dates — RapidMiner Community

    You can use the Generate Attribute operator and then the function datediff(), e.g

    date_diff([Date],date_parse_custom("04.03.2021","dd.MM.yyyy"))
    where [Date] is your Datetime attibute (Colum)

    Remember that datediff function return the difference in miliseconds, so if you need the difference in days or other units you need to divide it e.g
    (date_diff([Date],date_parse_custom("04.03.2021","dd.MM.yyyy")))*1.15741e-8 for days

    regards


Answers

  • ceaperezceaperez Member Posts: 522 Unicorn
    Hi @Tdragi13,

    Do you need to calculate the age based in a datetime atribute from database?

    Regards
  • Tdragi13Tdragi13 Member Posts: 5 Learner I
    Hi @ceaperez
    I need to generate a new discrete attribute, which indicates the age of people on a specific date. And for this, I need to use date operators. 

    The data must be taken from a column call "Date of birth" from the database.

    So for example. I need a new attribute which shows me the age of the people up to the 4/03/2021

    Thankss :smile: 
Sign In or Register to comment.