The function ecm:year returns the year component of the referenced date. The value returned is an integer data type.

Example

The date of each recipient's high school graduation is stored as a group member attribute. The year part of this date is extracted for use in a message. The expression for inserting this information in a message is constructed as follows:

<%${ecm:year(ecm:toDate(user.MemberAttribute['graduation_date'], ''))}%>
CODE
Note that the function ecm:toDate is also used to ensure that the value stored in the member attribute is formatted as a date data type to match the type required for the parameter.

Structure​

ecm:year(date)

Parameters​

Parameter

Description

date

Specifies the target date.