+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Event template show time in timezone

Event template show time in timezone

3 posts, 0 answered
  1. aclarke
    aclarke avatar
    2 posts
    Registered:
    22 Mar 2007
    04 Jun 2014
    Link to this post

    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.

  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    05 Jun 2014
    Link to this post
    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
     
  3. aclarke
    aclarke avatar
    2 posts
    Registered:
    22 Mar 2007
    10 Jun 2014 in reply to Vassil Vassilev
    Link to this post
    Perfect. Thanks Vassil!
3 posts, 0 answered