views:

93

answers:

1

We are haveing issue with DateTime on one of our application servers. The issue is the datetime is picking the locale settings as en-US and we want to use en-GB. I tried to Change the server Regional and Language options to UK still having the same issue. I could force DateTime to use en-GB but this will require code changes at various location. I tried to add globalization settings in web.config file still date time is picked as US. Is there a way I can fix this issue on that server since the code works fine on all other servers?

+2  A: 

It should be sufficient to set the <globalization> section in web.config. Set both the culture and uiculture parameter. If that won't work you can set the locale per thread via global.asax.

void Application_BeginRequest(object source, EventArgs e)
{
   string Lang = "en-GB";
   System.Threading.Thread.CurrentThread.CurrentCulture = 
      new System.Globalization.CultureInfo(Lang);
}
Mikael Svenson
This will require code changes and we are currently in a code freeze state. The server we are having issue is a test server and we need to fix this on just one machine. Is there a change on the server side which can fix the issue? also I would like to know why the web.config does not work.
Balaji
My guess is that the server was originally installed as en-us, and the locale settings for the user which your AppPool runs under still has this as the setting (http://www.justskins.com/forums/asp-net-application-wrong-culture-picked-up-59113.html). You could try to set globalization in machine.config as well.
Mikael Svenson