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

Forums / Set-up & Installation / How to set timezone / culture for SiteFinity

How to set timezone / culture for SiteFinity

4 posts, 0 answered
  1. Matt
    Matt avatar
    20 posts
    Registered:
    17 Oct 2008
    05 Mar 2009
    Link to this post
     Times are showing as US times, within the sitefinity admin interface, DB server and web server locale are en-GB

    in config I have
    <system.web> 
        <globalization uiCulture="en-GB" culture="en-GB" /> 
    and
    <telerik> 
        <localization defaultProvider="Sitefinity" persistenceMode="None" defaultCulture="en" cultures="en, es, fr, de, bg"

    I did try and set the defaultCulture="en-GB", but this didn't seem to make any difference. 

    Any tips on how I can get the the times in the admin interface to display in the uiCulture timezone ?

    Matt
  2. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    05 Mar 2009
    Link to this post
    Hi Matt,

    Localization settings are about language settings, they do not affect the datetime values stored in DB.

    Generally, Sitefinity stores all its data values in GMT (or more often referred to as Universal Time). However, upon retrieval from the database, they are converted to the server time zone. As of now, there is no implementation to convert this time to user machine time zone, but we are discussing it about 4.0 of Sitefinity.

    The problem is summarized as follows:
    • There is no timezone information in the HTTP header, so this cannot be processes at the server, at least not purely and without at least one postback (a performance hit for high-traffic servers).
    • The retrieved localized value has some specific culture format, which can be further customized from the Control Panel->Regional Settings, so parsing the localized value from javascript that is passed from the asp.net server is a nightmare
    • There is the Date.getTimezoneOffset() javascript method, but you need to parse the string date passed by the server-side.
    • The current implementation, as stated above, the server converts GMT time to local time, which can be even further customized on the server through Control Panel, so it is difficult to parse this in javascript. You could use Date.parse(), but it is far from perfect. For example, it has no chance at all to parse the Bulgarian "05 Март 2009г", and this is just one of the countless possibilities.

    You could, of course, make a custom/user control that encapsulates a certain sitefinity control which have a metafield, for example "Publish_Date", and convert the date back to the neutral culture + universal time. Then implement a javascript function that takes that string and converts it to user time, when it is presented to the user. Then call this(perhaps in page's onload)  to fill the corresponding html tag. The latter could be done in the control template. It is a suggestion and not an actual solution, really, but generally this is what I would do.

    Regards,
    Dido
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Matt
    Matt avatar
    20 posts
    Registered:
    17 Oct 2008
    05 Mar 2009
    Link to this post
    Thanks Dido

    Just to make it clear I was looking for a way of setting the default timezone across the entire application, server side, though a client side also work for me!
    I guess  the user machine locale could help you out, but you'd have to setup each application to run as a different user, which could be a pain for multiple application hosts, and you could have some awkward issues re concurrency if the application is running using windows authentication and the users had different timezones.

    have a look at 
    http://stackoverflow.com/questions/441109/get-datetime-for-another-time-zone-regardless-of-local-time-zone

    it's easy to work with different / specific timezones in .net 3.5 .. and possible, but more painful in .net 2.0, since you're requiring .net 3.5 from sitefinity 3.6 onward, you can use the good stuff anyway :).

    Matt
  4. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    06 Mar 2009
    Link to this post
    Hello Matt,

    Thanks for pointing this out!

    We are aware of the problem and we are still considering the solution, but we know of the TimeZoneInfo class. Sadly, though, there is no way to get the necessary client information without javascript, and passing back and forth the information would be a bottleneck in performance, so the whole conversion should be done in JavaScript. A remedy would be passing the dates in a neutral and Date.parse() friendly format, as well as in GMT. Then it will be relatively easy to display date and time in a localized for the user machine format.

    If you, too, are interested on the subject, here are some more articles:

    Sincerely yours,
    Dido
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered