Event template show time in timezone - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Event template show time in timezone

  • Event template show time in timezone
  • 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.

  • 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
     
  • Perfect. Thanks Vassil!