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

Forums / General Discussions / Wrong time displayed in forum

Wrong time displayed in forum

5 posts, 1 answered
  1. Jeff
    Jeff avatar
    118 posts
    Registered:
    08 Jul 2011
    07 Mar 2013
    Link to this post

    I'm displaying the time of the post on the "List of Posts" template in the forum using the following:

    <%# ((DateTime)Eval("LastPostDate")).ToString("h:mm tt") %>

    It's returning the wrong time... +6 hours. How can I fix this? The time zone is set correctly in the settings to (UTC-06:00) Central Time (US & Canada).

  2. Jeff
    Jeff avatar
    118 posts
    Registered:
    08 Jul 2011
    10 Mar 2013
    Link to this post
    Anyone?
  3. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    10 Mar 2013
    Link to this post

    Hi Jeff,

    Sitefinity stores the date in UTC. It think it's a bug if the forum template is displaying the date the way you posted it here, as it is just ignoring the time zone you have set. Can you try the code below?

    <%# Telerik.Sitefinity.SystemExtensions.ToSitefinityUITime(((DateTime)Eval("LastPostDate"))).ToString("h:mm tt") %>

  4. Jeff
    Jeff avatar
    118 posts
    Registered:
    08 Jul 2011
    11 Mar 2013 in reply to Arno
    Link to this post
    That worked. Thanks Arno!
    Answered
  5. Arm
    Arm avatar
    5 posts
    Registered:
    01 Apr 2013
    14 Feb 2014
    Link to this post
    I have faced the same issue. But your solution didn't work for me. If I set time to 12am, database time sets  6pm . And after binding items as you suggested it anyway shows 6pm . Timezone settings are  UTC-6. 
5 posts, 1 answered