locked
Overriding US locale setting in code RRS feed

  • Question

  • User640374800 posted

    I am looking into an issue whereby an old ASP website hosted within an Azure virtual server is storing dates as US format (mm/dd/yyyy) in the database due to this server having its locale settings as US.

    I have been told by the team who manage this server that this cannot be changed.

    So i am looking into what options i have to manage this. As the dates display fine in the development servers (which are GB locale) i need to do something that is specific to the azure server.

    As this is an old ASP website, i wasn't sure what my options were... possibly some detection of the locale within the code and format the date accordingly before it is posted off to the stored procedure? Or some way to have an environment-specific config setting in web.config to say whether the environment is GB or US, and pass this as a parameter to the SP? I am not sure how old ASP sites read the config file but am sure it could be done...

    Reading online, a suggestion was to use - Session.LCID = 2057 - within the global.asa file session start, however this is already in the code so hasn't had any effect.

    Any ideas welcome...

    Thursday, February 25, 2021 10:43 AM

All replies

  • User753101303 posted

    Hi,

    Maybe it needs to be done on each and aevery request. I tried a test page such as 

    <%
    Session.LCID=1033
    Response.Write Now() & "<br>"
    Session.LCID=2057
    Response.Write Now()
    %>

    And I do see a US and then UK date...

    Monday, March 8, 2021 4:38 PM