The function ecx:durationBetween calculates the difference between two dates in a specified unit. The value returned is a string data type.

Example

Calculate the number of days between a recipient's date of birth, which is stored as an attribute value, and the current date. The function is constructed as follows:

${ecx:durationBetween(user['DateOfBirth'], date.Today, 'days')}
CODE

Structure​

ecx:durationBetween (date, date, string)

Parameters​

Parameter

Description

date

The value used as a start date.

date

The value used as an end date.

string

Specifies the unit of time used to calculate the duration. Possible units include 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months' and 'years'.