The function ecm:age returns the number of years between two dates. The value returned is a long data type.
Example
A Personalization is displayed to recipients who are 20 years or older at the time of message sendout. The function ecm:age compares the date of birth stored in a user attribute to the current date and returns a long number. This number is evaluated (using the mathematical operator greater than or equal) to return a Boolean value. If a Boolean value true is returned, the personalization is inserted into the message with an InsertIf statement. The InsertIf is constructed as follows:
<%InsertIf expression="${((ecm:age(user['DateOfBirth'], 'date.Today')>='20'))}"%>Text<%/InsertIf%>
CODE
Structure
ecm:age(date, date)
Parameters
Parameter | Description |
---|
date | Specifies the target date. |
date | The date value used for the comparison. |