How to capture the current date/time into a eVar

Avatar

Avatar

manishs40044499

Avatar

manishs40044499

manishs40044499

14-07-2017

Hello All,

I want to capture and save the current date into a eVar which can be used for reporting and analysis purpose later. I can see that date/time into Adobe debugger. Could anybody please help me to capture the same into a eVar.

Also this timestamp is showing in different time zone even though I have selected my current time zone in report suite settings. Please guide me if this can also be changed to proper timezone.

1249071_pastedImage_1.png

Regards,

Manish

View Entire Topic

Avatar

Avatar

marion69081899

Avatar

marion69081899

marion69081899

18-06-2018

Hello Adobe Community !


Hello ericmatisoff


I don't want to be negative about this, but I tried to follow the tutorial on your document, and it's very well documented,

But even this did not work. I believe there is a problem on the order of loading in the JS objects. The main issue was that the s object was "Unspecified" - and I believe that this was only true when the DTM was calling for this object - since I could use it on the console once every thing was loaded.

But it's ok , I implemented a new context data that manages to give the Date without using the s object as in :

s.getTimeParting = ....

so what id did in my Context data is this :

function addZero(i) {

    if (i < 10) {

        i = "0" + i;

    }

    return i;

}

function myTimePlugin() {

    var d = new Date();

    var h = addZero(d.getHours());

    var m = addZero(d.getMinutes());

    var s = addZero(d.getSeconds());

    var d = addZero(d.getDay());

    switch(d){

        case "01":

            d = "Monday";

            break;

        case "02":

                d = "Tuesday";

                break;

        case "03":

                d = "Wednesday";

                break;

        case "04":

                d = "Thursday";

                break;

case "05":

d = "Friday";

break;

case "06":

d = "Saturday";

break;

case "00":

d = "Sunday";

break;

}

var time2 = h + ":" + m + ":" + s + "|" + d;

return time2;

}

var myTimeStamp = myTimePlugin();

return myTimeStamp;

Sorry for the indentation !

There should be a WYSIWIG for code !

Cheers !