Time Zone on Events off by 5hrs

Jul 1, 2010 at 3:18 PM

Did I miss something?   Why is the timezone off by 5hrs (CST) even if I set the event time zone, it still displays on the webportal 5hrs different?

Jul 8, 2010 at 6:11 PM

I believe the reason you are seeing a discrepancy in the event listing's datetime is because the portal is rendering the datetime in the server's timezone.  Since the user is not required to be logged on to register for events, the code is unable to take advantage of the contact record's timezone setting as it does in the "Schedule a Service" feature of the portal.  With this in mind, you can choose to do one of the following:

1 - Change the code such that the user is required to logon to view the event listings.  You can then utilize the contact record's timezone setting to adjust the datetime so that it displays correctly to the user.

2 - You can convert the datetime to UTC and then use some javascript code to determine the users local timezone settings.

3 - Or you can simply adjust line 22 of the EventListing.aspx file to include the name of the server's timezone, thus clearing up any timezone ambiguity.

<div class="date-line"><%# string.Format("{0:dddd, MMMM d, yyyy h:mm tt} ({1})", Eval("msa_startdatetime"), TimeZone.CurrentTimeZone.StandardName)%></div> 

Hope this helps.

Christine Fischer
Adxstudio - Developer

Jul 8, 2010 at 6:29 PM

Be sure also to set the TZ for the user (you):

Here's a post by David Frattalone: http://blog.customereffective.com/blog/2008/10/time-zone-issue.html


Jul 8, 2010 at 7:35 PM

All of the timezones are the same... all set to CST (USA).  (first thing I checked)

I just finished installing this in another test environment as well, and am getting the exact same issue.

If I schedule an event for 1pm (CST - USA) it will display on the Portal Page as 6pm.


Jul 9, 2010 at 10:19 PM
I'm not sure why the time is all messed up because my server and the client browser windows all share hte same time zone (PST). However, I too see the time for the event being off. In my case it is set to GMT/UTC time. For the campaign, it's pulling the msa_startdatetime attribute, which when retrieved from the filteredcampaign view returns the locate time (as opposed to UTC). Anyway, I made this change to line 22 of EventListing.aspx and it seems to work for me so far.
<%# string.Format("{0:dddd, MMMM d, yyyy h:mm tt}", Convert.ToDateTime(Eval("msa_startdatetime")).AddHours(DateTime.Now.Subtract(DateTime.UtcNow).Hours))%>
I'll probably have to do this in other places which seems highly unecessary. I haven't gotten too much into the source code, but from my the cursory glance so far, I'm not sure why it's not pulling the correct time zone when retrieving data. Maybe someone from ADX can chime in again.
Jul 9, 2010 at 10:53 PM

Forgot about the ToLocalTime() method.  Use this instead: 
<div class="date-line"><%# string.Format("{0:dddd, MMMM d, yyyy h:mm tt}", Convert.ToDateTime(Eval("msa_startdatetime")).ToLocalTime())%></div>