Segment 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 to compare the result of the last 24 hours versus 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.
Imagine you wish to create segment users that “exactly 24.02.2021 clicked on your email campaign”
In this case for:
- For date attributes, you will get the segment of customers that clicked on the email campaign 24.02.2021.
- For datetime attributes you will get the segment of customers 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 Attributes tab/ Data tab in the Examples section.
Predefined conditions
Predefined conditions |
Exactly Since Until Since-Until Matches current day/ month/ year (week is coming soon) Matches last day/ week/ month/ year (coming soon) As well as if the date is known or is not known. |
Natural language
Natural language supports various commands, based on the Python parsedatetime library, like “now”, “today”, “yesterday”, “tomorrow”, "yyyy-mm-dd".
It is important to note that:
- for date attributes, it will return and refer to dates.
- for datetimes attributes, it will return and refer to the date and exact time (when the segment was saved).
For example:
If today is 24.02.2021 10:00, and in the natural language section we specify “since yesterday” (yesterday in natural language), it will bring the result for:
- date attribute: all results since 23.02.2021 until now,
- datetime attributes all results since 23.02.2021 10:00 until now.
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 especially useful 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 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 esult 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. More precise result would bring: since “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). |