The function ecm:trunc returns a new date where the specified time or date component is reset to a default value (truncated). The value returned is a date data type.

Example

A selection is used to send a thank you message to group members on the anniversary of the date they signed up for a newsletter. This date is stored in the custom attribute ​WelcomeDate​.

The function ecm:trunc is used to reset the time component for both the current date and the attribute value to zero. It is then possible to use the function ecm:equal to define the selection criteria because the time component is negated. The expression for use in the selection is constructed as follows:

${ecm:equal(ecm:trunc(user.CustomAttribute['WelcomeDate'], 'time')), (ecm:trunc(date.Today, 'time'))}
CODE

Structure​

ecm:trunc(date, string)

Parameters​

Parameter

Description

date

Specifies the target date.

string

Specifies the date component to truncate. The following values are considered valid for this parameter:

time

Resets the time component to 00:00:00.0.

year

Resets the year component to the epoch.