Date Attribute
The date attribute stores the timestamp of an event.
How it works
Use the date attribute to store important timestamps such as First Purchase Date, Last Checkout Date, or Last Visit date.
The date attribute is available for the following scopes: Event, Visit and Visitor.
Date formatter
To convert a string attribute to a date, use the date formatter. Select the timestamp components from the date format panel that match the string values. For example, a string value such as 01/31/2020
can be converted to a date using a format of MM/dd/yyyy
.
Date and time string patterns:
G Era designator (before christ, after christ)
y Year (e.g. 12 or 2012). Use either yy or yyyy.
M Month in year. Number of M's determine length of format (e.g. MM, MMM or MMMMM)
d Day in month. Number of d's determine length of format (e.g. d or dd)
h Hour of day, 1-12 (AM / PM) (normally hh)
H Hour of day, 0-23 (normally HH)
m Minute in hour, 0-59 (normally mm)
s Second in minute, 0-59 (normally ss)
S Millisecond in second, 0-999 (normally SSS)
a AM / PM marker
z Time Zone
Z RFC 822 Time Zone
' Escape for text delimiter
' Single quote
Reference (with examples): SimpleDateFormat Java Class
If the string includes a T
, ensure that you include single quotes before and after the T
in the expression (for example, a 2024-08-22T10:24:58.905
string will use the expression yyyy-MM-dd'T'HH:mm:ss.SSS
).
Size Limits
The size of a each date attribute is limited to the following range:
- Minimum:
-292275055-05-16T16:47:04.192Z
- Maximum:
+292278994-08-17T07:12:55.807Z
These attributes are also limited by the maximum size of the profile after encryption and compression (400 KB).
Date enrichments
Capture date
The Capture Date enrichment sets the attribute to the current timestamp at the time of an event condition. This enrichment is available for scopes: event, visit and visitor.
For example, to capture the Last Purchase Date, use this enrichment with a rule that identifies a purchase event.
Attribute Name: Last Purchase Date
- Starting Value:
""
- Enriched With:
- Resulting Value:
1491233145706
Set date
The Set Date enrichment sets the attribute to the value of another attribute. If the other attribute is a string, use the Date Formatter to convert it to a date. This enrichment is available for attributes: event, visit and visitor.
Attribute Name: Last Purchase Date
- Starting Value:
""
- Enriched with String:
01/04/2019
- Using Format:
dd/MM/yyy
When you use the Set date enrichment to set an EventStream date from another date attribute (EventStream or AudienceStream), you can use a placeholder for the format string. For example, in the Set Date enrichment, set the following:
- Set date to: The date attribute you want to set the value to. In this example,
date_of_birth
. - with date format: Enter any placeholder, for example,
x
.
Remove date
The Remove Date enrichment erases the value of a date attribute. This enrichment is available for attributes: event, visit and visitor.
Attribute Name: Last Visit Date
- Starting Value:
1491233145706
- Resulting Value:
""
Convert from date format
The Format Date enrichment sets the value based on an expected date format of incoming values. This enrichment is used to convert string data types sent from the Collect tag or API into a date type. Use the Date Formatter to convert the string data to a date.
This enrichment is only available for event attributes.
This page was last updated: August 28, 2024