Expand my Community achievements bar.

SOLVED

Problem with date time in Adobe Campaign web application

Avatar

Level 3

Hi,

I've created a web application where I have a variable containing date and time.

If I print the variable in an HTML element I see the date and time as required,

but if I'm calling the variable from a date input field then I see a different time (see below)

webapp1.JPG

In the HTML element in the page the time is 17:00 but its 22:00 in the input field.

both are using the same variable - 'varSendStart'

webapp2.JPG

Does anyone know how can it be fixes?

Thanks,

Sagi

1 Accepted Solution

Avatar

Correct answer by
Level 3

I've tried changing my computer time zone to the time zone of the server and the times looked good then.
Anyhow since we have users in multiple time zones I tried to avoid all this time zone managing. I used the field as a text instead of a date and it seems to worked fine from all locations (just needed to apply some validation rules on the input to check if its a real date)/

Thanks you
Sagi

View solution in original post

6 Replies

Avatar

Level 10

Hi Sagi,

It looks like a time zone issue to me. Can you ensure that you are using same time zone for a web app and your user profile?

Regards,

Amit

Avatar

Level 3

Hi Amit,
Both the user and the web app are configured to use the server time zone:

user1.JPG

webapp3.JPG

Sagi

Avatar

Level 10

Hello Sagi,

I agree with Amit, it is clearly a timezone management subject, but probably not an issue, to my mind, but more method involved to manage in your code. Frankly said, timezone management is always difficult, either in SQL or in Javascript...

So, please may you give more information:

  • debug context
  • how you get the calendar variable value (formatDate, etc), Javascript code of variable setting/getting the value
  • check that the variable is defined as date+time
  • the JS code to display in the webApp compatibility v5 the calendar object value set with your variable

I tried to reproduce it but it works fine for me, either with 3 PM time format or my preferred time format for France 15:00. (and even with variable defined with text format...), with that method:

1. javascript activity to set the variable value:
ctx.vars.var2 = getCurrentDate()

2. the value doesn't appear without specific code in the calendar type field (blank); but after selecting the value of date of current day, hour is correctly set to current time (local time) :

1274627_pastedImage_5.png

Please do some logInfo in order to check that the calendar date object is correctly registered with the standardized datetime value (the format stored internally in the DB) after the webApp.

1274628_pastedImage_7.png
Before, if you set if with getCurrentDate, the date is displayed in another format except if you do some formatDate, depending on your need), as kind of:

ctx.vars.datetime_jour = formatDate(getCurrentDate(),"%4Y-%2M-%2D %02H:%02N:%02S")

Many thanks in advance for your complementary information.

Best Regards
J-Serge

Avatar

Correct answer by
Level 3

I've tried changing my computer time zone to the time zone of the server and the times looked good then.
Anyhow since we have users in multiple time zones I tried to avoid all this time zone managing. I used the field as a text instead of a date and it seems to worked fine from all locations (just needed to apply some validation rules on the input to check if its a real date)/

Thanks you
Sagi

Avatar

Level 10

Hi Sagi,

Were you able to resolve your issue?

Florent

Avatar

Level 3

Hi,

Yes just as I've mentioned above, I used it as text and not as a date placed a JS validation rules for the input and that worked.

Thanks,

Sagi