Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

classifying the date

Avatar

Level 4

I have date and timestamp captured in an eVar in below format

2022-10-27 20:18:48

 

How can I classify that in Analysis workspace to see the data by month, day and time?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Adobe already captures a timestamp value on every hit, based on the time zone you have configured your suite to... If you are dealing with an international site, with people in different time zones and you are trying to capture their local time I suppose this would work, but you should consider that client side time may not be accurate (you would be surprised how often people have their system time set incorrectly).

 

That said, you should be able to create classifications on your evar:
https://experienceleague.adobe.com/docs/analytics/components/classifications/c-classifications.html?...

(note that you will see the old Reports first, but the Report Suite settings where you start creating classifications is still relevant)


Create your classifications for year, month, day, time under the proper eVar.

Now go into the Classification Rule Builder (https://experienceleague.adobe.com/docs/analytics/components/classifications/classifications-rulebui...), where you will will want to use Regex to parse out parts of timestamp to convert into usable information.

 

One possible regex (to break your datetime stamp into pieces) could be:

(\d{4})-(\d{2})-(\d{2})\s(\d{2}:\d{2}:\d{2})

^ note that this assumes that months and days and hours are always 2 digits - i.e. 08


group $0 is the whole string

group $1 is the year

group $2 is the month

group $3 is the day

group $4 is the time

 

Now this is helpful only if you want to see the values in numeric formatting, with a simple populate classification with group value.

 

If you want to convert month "10" into "October" you will need to create 12 rules specifically for the each month

 

For example, for the month of October, you would use the regex almost as above, but would look specifically for "10" to be October:

(\d{4})-(10)-(\d{2})\s(\d{2}:\d{2}:\d{2})

 

Then in the Month classification, you would type "October" instead of $2 (forcing this specific rule, looking for October

 

Since there is unlikely any data transformation for year or day, you can use the first regex multiple time (once to set group $1 as year classification, and again to set $3 as day classification)

 

If you want to convert the time to 12 hour time, you would need to do the same trick as month (24 rules) set to look specifically at the hour  (so you would also need to modify the rules a bit to split the hour from the rest of the time, so that you can transform it.

 

(\d{4})-(\d{2})-(\d{2})\s(20)(:\d{2}:\d{2})

 

Then you could set your classification to 8$5 pm

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Adobe already captures a timestamp value on every hit, based on the time zone you have configured your suite to... If you are dealing with an international site, with people in different time zones and you are trying to capture their local time I suppose this would work, but you should consider that client side time may not be accurate (you would be surprised how often people have their system time set incorrectly).

 

That said, you should be able to create classifications on your evar:
https://experienceleague.adobe.com/docs/analytics/components/classifications/c-classifications.html?...

(note that you will see the old Reports first, but the Report Suite settings where you start creating classifications is still relevant)


Create your classifications for year, month, day, time under the proper eVar.

Now go into the Classification Rule Builder (https://experienceleague.adobe.com/docs/analytics/components/classifications/classifications-rulebui...), where you will will want to use Regex to parse out parts of timestamp to convert into usable information.

 

One possible regex (to break your datetime stamp into pieces) could be:

(\d{4})-(\d{2})-(\d{2})\s(\d{2}:\d{2}:\d{2})

^ note that this assumes that months and days and hours are always 2 digits - i.e. 08


group $0 is the whole string

group $1 is the year

group $2 is the month

group $3 is the day

group $4 is the time

 

Now this is helpful only if you want to see the values in numeric formatting, with a simple populate classification with group value.

 

If you want to convert month "10" into "October" you will need to create 12 rules specifically for the each month

 

For example, for the month of October, you would use the regex almost as above, but would look specifically for "10" to be October:

(\d{4})-(10)-(\d{2})\s(\d{2}:\d{2}:\d{2})

 

Then in the Month classification, you would type "October" instead of $2 (forcing this specific rule, looking for October

 

Since there is unlikely any data transformation for year or day, you can use the first regex multiple time (once to set group $1 as year classification, and again to set $3 as day classification)

 

If you want to convert the time to 12 hour time, you would need to do the same trick as month (24 rules) set to look specifically at the hour  (so you would also need to modify the rules a bit to split the hour from the rest of the time, so that you can transform it.

 

(\d{4})-(\d{2})-(\d{2})\s(20)(:\d{2}:\d{2})

 

Then you could set your classification to 8$5 pm

Avatar

Community Advisor

You're very welcome 🙂

 

Regex can be tricky, for future reference I like to use https://www.regextester.com/ to build out and test my rules before bringing them into Adobe's Rule Builder... the problem there is that while building, you can only validate against one string at a time... and going to the test screen can sometimes be a pain.

 

With this tool, if you use the multi-line flag, you can add many different values (one per line) that you can check all at once.

Avatar

Level 4

Thats super helpful. Because I always land up with 1 line regex test tool on the web. I will bookmark  this one so that it will be easier to do multiple lines.