More in this section

Forums / Developing with Sitefinity / Sitefinity Showing the Wrong Time Offset From UTC

Sitefinity Showing the Wrong Time Offset From UTC

1 posts, 0 answered
  1. Merritt
    Merritt avatar
    31 posts
    11 Mar 2011
    23 Jul 2015
    Link to this post
    Sitefinity seems to improperly calculate Date Offsets from UTC.

    For example, here's a datetime stored in their system: 2015-10-21 00:30:00.000 (Make a custom field or Dynamic Content with a DateTime field).

    Now let's say you want to see that field for Central Standard Time. The easiest way to do this is goto Settings->Advanced->System->UI Time Zone Config. Set the CurrentTimeZoneInfo to "Central Standard Time" (this change propogates to the basic settings for Time Zone).

    Now view it in the backend. It says 20 Oct, 2015 08:30:00. Well, according to my calculations, it's actually 7:30.

    Here's my test code:

    string zone = "Central Standard Time";
    TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById(zone);
    var asdf = DateTime.Parse("2015-10-21 00:30:00.000");
    DateTime dt = TimeZoneInfo.ConvertTimeFromUtc(asdf, tz);

    Am I missing something here?
1 posts, 0 answered