Segment builder: date & datetime attributes
Learn from this article about: |
Date vs. datetime attributes
Formats of the attribute are usually set by the analyst that implements Meiro Business Explorer. For date attribute (like birthday, date of particular action, etc.) it can be date or datetime type:
Date (dd.mm.yyyy) |
for example, attribute date of birth with values 12.9.1987 |
Datetime (dd.mm.yyyy hh:mm:ss) |
for example, attribute date & time of the last clicked email 13.9.2020, 12:45:46. Datetime is useful for example, for use cases with intervals of time smaller than 24 hours. For example, compare the result of the last 24 hours versus the last 12 hours for a particular attribute. |
Warning: It is important to know which one of those your date attribute is, as this may influence your results.
If you want to create a segment of users who "exactly on 24.02.2021 clicked on your email campaign", the behavior will differ depending on whether you use a date
or datetime
attribute:
- For
date
attributes, the resulting segment will include customer profiles that clicked on the email campaign on February 24th, 2021. - For
datetime
attributes, you will get the segment of customer profiles that clicked on the email campaign 24.02.2021 at a particular time (likely the one you saved your segment). This means that using "exactly" for datetime attributes will be more granular and may be misleading.
Examples of the attributes can be checked in the Data library/ Attributes tab in the Examples section.
Predefined conditions
Predefined conditions |
|
Natural language
The natural language supports various commands, based on the Python parsedatetime library, such as “now”, “today”, “yesterday”, “tomorrow”, "yyyy-mm-dd".
It is important to note that:
- If a
date
attribute is specified, the system will return and refer to dates only. - If a
datetime
attribute is specified, the system will return and refer to the date and exact time when the segment was saved.
For instance, if it is currently 10:00 AM on February 24th, 2021, and we specify "since yesterday" in the natural language section, the system will bring the following result:
- For
date
attribute, all results since February 23rd, 2021 until now. - For
datetime
attribute: all results since February 23rd, 2021 at 10:00 until now.
Remember: The clock icon changes color to immediately show whether the entered date(time) condition is correct. If a valid date or time is inputted using natural language, the clock icon will turn green. If an invalid date is entered, the clock icon will turn red.
Natural language |
Result |
“Today” vs. “now” |
For datetime, “today” will return the same date at 9:00. "Now" will return the exact time (when the segment was saved). |
“Midnight” or exact time |
Exact time in natural language is handy for Datetime attributes. This way, we are sure what time and date we are exactly referring to. For example, “since midnight 24.02.2021” return results from 24.02.2021 00:00 or “since 23.02.2021 12:00” returns results from 23.02.2021 12:00. |
“-{number} days” |
It is possible to insert “-{number} days”. If today is 24.02.2021 13:53:51 for “-5 days” the result will be 2021-02-19 (but if the attribute is datetime will also include reference to the current time: 2021-02-19 13:53:51). |
“{number} days” |
If today is 24.02.2021”20 days” will return 16.03.2021. |
“monday”, “tuesday”, “wednesday”, “thursday”, “friday”, “saturday”, “sunday” |
For “monday” the result will be the closest Monday. So if today is Wednesday 24.02.2021, the result will be 01.03.2021. If today is Wednesday and in natural language, we insert "wednesday", the result will be the closest Wednesday in the future, in this case 03.03.2021. |
"last monday 1 week ago" |
The result will be the closest Monday 1 week ago. So for 24.02.2021 (Wednesday) the result will bring 15.02.2021. |
'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', “sep”, “oct”, “nov”, “dec” |
Those will return 1st of the month of the current year. So if today is 24.02.2021, “jan” will return “01.01.2021”. Warnings: “last week”: If today is 24.02.2021 will return 17.01.2020 9:00, "last month”: If today is 24.02.2021 will return 01.01.2021 9:00; “last year”: If today is 24.02.2021 will return 01.01.2020 9:00.
|
Best practices
Matches current day | Will give results that happened on the same date when the segment was saved. For example, if the segment was saved 04.02.2021, the result will be shown for 04.02.2021. |
Matches current month | Will give results that happened the same month when the segment was saved. For example, if the segment was saved 04.02.2021, the result will be shown from 01.02.2021. |
Matches current year | Will give results that happened the same year when the segment was saved. For example, if the segment was saved 04.02.2021, the result will be shown from 01.01.2021. |
Yesterday |
For date attribute: exactly “yesterday”, or since "yesterday" until "now" for results that are happening from yesterday until now. For datetime attribute, it must be specified further: Since “yesterday midnight” until “today midnight”, or since “yesterday midnight” until now for results that are happening from yesterday until now. Condition: ”matches yesterday” is coming soon. |
Results for the last 7 days/ 14 days |
To get the results for the last 7 days, for date attributes it is possible to use "-7days" (or "7 days ago"), until "now". To get the results for the last 7 days, for datetime attributes it is possible to use "-7days midnight" (or "7 days ago"), until "now". To get the results for the last 14 days, for date attributes it is possible to use "-14days midnight" (or "14 days ago"), until "now". |
Exactly |
It is recommended for dates. It is NOT recommended for datetimes, as it may be too precise. For example, "Exactly yesterday" if today is 24.02.2021
Warning: Exactly “- days” (for the datetime it may return results matching exact day & time). “Exactly today” will return today at 9:00. The more precise result would bring: from “midnight -3days” and until “midnight -2days”.
|
Datetime and "-{number} hours"
|
For datetime, useful commands may be “now -{number} hours”, like “now -12hours” (to get the result from not until 12 hours ago). |
No Comments