I'd like it to be dynamic I do not know if we can do that.??
TalendDate.diffDate(TalendDate.parseDate("dd-MM-yyyyy","TalendDate.getCurrentDate()"),TalendDate.parseDate("dd-MM-yyyyy","row6.dateNaiss"),"dd")
But it shows me an error: Type mismatch: can not convert long to float
I also tried it
test.agePatient==null?(String.valueOf((TalendDate.diffDate(TalendDate.getCurrentDate(), row6.dateNaiss,"yyyy"))).toString():test.agePatient);
and it also
test.agePatient==null? String.((TalendDate.diffDate(TalendDate.getCurrentDate(),row6.dateNaiss,"yyyy"))).(TalendDate.parseDate(test.agePatient));
But I still have errors
Can you help me please?
Regards.
Try to understand what the functions actually do so you can pass the correct parameters to them.
Assuming dateNaiss is a Date not a String: TalendDate.diffDateFloor(TalendDate.getCurrentDate(),row6.dateNaiss,"yyyy")
Your type mismatch error is coming from somewhere else in your job. Look at the Code tab to see exactly where.
Hi,
thank you for responding so quickly
look, in my MySQL database, I have a date of birth that is like this: dd-mm-yyyy, Example 09-11-1984. and I would like to calculate the age of the person using the current date.
If it's a Date in MySQL and you're reading it into Talend as a Date then the format in which it's displayed is irrelevant and the expression I gave you will do what you want.