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"))%>' />
Perfect. Thanks Vassil!