Use activity “Change object” using entity “IteratorCustomer” and set attribute “Year” to value parseInteger(formatDateTime($IteratorCustomer/dateofbirth, ‘yyyy’))
** Edited ** replaced formatDate with format DateTime, replaced Dateofbirth with dateofbirth and replaced “yyyy” with ‘yyyy’
Thanks for the answer.
i am getting an error message , maybe i did something wrong. please see image below.
You have an error because you are using double quote (“) instead of simple quote(‘)
i fixed the typo and it show an error “invalid argument types(Date and Time , string) function format date expect a a”date and time).
but when i look at the attribute type of dateofbirth in the domain model it is already set to date and time.
see image below.
The function call should read parseInteger(formatDate($IteratorCustomer/dateofbirth, “yyyy”)) → note the lower case d. Mendix is case sensitive and looking at your domain model, the attribute name is all lower case.
Also, an alternative way to do this is with the Java Action GetIntFromDateTime from Community Commons. Add this Java action to your microflow and configure it with the date and the part of the date you want as an integer (month, day or year)