Event template show time in timezone

Posted by Community Admin on 04-Aug-2018 12:02

Event template show time in timezone

All Replies

Posted by Community Admin on 04-Jun-2014 00:00

Hi,

I am running the latest version of sitefinity (7.0) which allows me to create events and associate them to a timezone. Great feature addition.

What I would like to to is display the event start time as the time in the timezone rather than the local time. The template uses DateTime.ToLocalTime to display the local time.

<sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# ((DateTime)Eval("EventStart")).ToLocalTime() %>' />

 Any ideas on how to display the time of the event in it's timezone rather than the local time?

Thanks.

Posted by Community Admin on 05-Jun-2014 00:00

Hello Andrew,

You could try something like this:

<sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# ((DateTime)Eval("EventStart")).AddMinutes((double)Eval("EventEndUtcOffset"))%>' />
          <sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# ((DateTime)Eval("EventEnd")).AddMinutes((double)Eval("EventEndUtcOffset"))%>' />

The above will always show the time you set in Event`s backend edit dialog.

Hope this helps.

Regards,
Vassil Vassilev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 10-Jun-2014 00:00

Perfect. Thanks Vassil!

This thread is closed